Class: AR2DTO::Converter
- Inherits:
-
Object
- Object
- AR2DTO::Converter
- Defined in:
- lib/ar2dto/converter.rb
Constant Summary collapse
- ALLOWED_TYPES =
[Symbol, BigDecimal, Regexp, IO, Range, Time, Date, DateTime, URI::Generic, Pathname, IPAddr, Process::Status, Exception].freeze
Instance Attribute Summary collapse
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(model, options) ⇒ Converter
constructor
A new instance of Converter.
- #serializable_hash ⇒ Object
Constructor Details
#initialize(model, options) ⇒ Converter
Returns a new instance of Converter.
9 10 11 12 |
# File 'lib/ar2dto/converter.rb', line 9 def initialize(model, ) @model = model @options = apply_configs() end |
Instance Attribute Details
#model ⇒ Object (readonly)
Returns the value of attribute model.
7 8 9 |
# File 'lib/ar2dto/converter.rb', line 7 def model @model end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/ar2dto/converter.rb', line 7 def @options end |
Instance Method Details
#serializable_hash ⇒ Object
14 15 16 17 18 |
# File 'lib/ar2dto/converter.rb', line 14 def serializable_hash hash = model.serializable_hash(&.except(:methods, :include)) hash = add_methods(hash) add_associations(hash) end |