-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0678465
commit 2c192a9
Showing
4 changed files
with
81 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,16 @@ | ||
# This configuration was generated by | ||
# `rubocop --auto-gen-config` | ||
# on 2024-05-30 18:44:57 UTC using RuboCop version 1.63.4. | ||
# on 2024-06-05 00:21:36 UTC using RuboCop version 1.63.4. | ||
# The point is for the user to remove these configuration records | ||
# one by one as the offenses are removed from the code base. | ||
# Note that changes in the inspected code, or installation of new | ||
# versions of RuboCop, may require this file to be generated again. | ||
|
||
# Offense count: 6 | ||
# Offense count: 2 | ||
# Configuration parameters: AllowedConstants. | ||
Style/Documentation: | ||
Exclude: | ||
- "lib/transmutation/class_attributes.rb" | ||
- "lib/transmutation/collection_serializer.rb" | ||
- "lib/transmutation/serialization.rb" | ||
- "lib/transmutation/serializer.rb" | ||
- "lib/transmutation/string_refinements.rb" | ||
- 'spec/**/*' | ||
- 'test/**/*' | ||
- 'lib/transmutation/serialization.rb' | ||
- 'lib/transmutation/serialization/rendering.rb' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,43 @@ | |
loader = Zeitwerk::Loader.for_gem | ||
loader.setup | ||
|
||
# A performant and expressive solution for serializing Ruby objects into JSON, with a touch of opinionated "magic" ✨. | ||
# | ||
# @example Basic usage | ||
# # Define a data class. | ||
# class User | ||
# attr_reader :name, :email | ||
# | ||
# def initialize(name:, email:) | ||
# @name = name | ||
# @email = email | ||
# end | ||
# end | ||
# | ||
# # Define a serializer. | ||
# class UserSerializer < Transmutation::Serializer | ||
# attribute :name | ||
# end | ||
# | ||
# # Create an instance of the data class. | ||
# user = User.new(name: "John", email: "[email protected]") | ||
# | ||
# # Serialize the data class instance. | ||
# UserSerializer.new(user).to_json # => "{\"name\":\"John\"}" | ||
# | ||
# @example Within a Rails controller | ||
# class UsersController < ApplicationController | ||
# include Transmutation::Serialization | ||
# | ||
# def show | ||
# user = User.find(params[:id]) | ||
# | ||
# # Automatically lookup the UserSerializer | ||
# # Serialize the data class instance using the UserSerializer | ||
# # Render the result as JSON to the client | ||
# render json: user # => "{\"name\":\"John\"}" | ||
# end | ||
# end | ||
module Transmutation | ||
class Error < StandardError; end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters