Class: Protobuf::ActiveRecord::Transformer
- Inherits:
-
Object
- Object
- Protobuf::ActiveRecord::Transformer
- Defined in:
- lib/protobuf/active_record/transformer.rb
Instance Attribute Summary collapse
-
#callable ⇒ Object
Returns the value of attribute callable.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(callable, options = {}) ⇒ Transformer
constructor
A new instance of Transformer.
- #nullify?(proto) ⇒ Boolean
Constructor Details
#initialize(callable, options = {}) ⇒ Transformer
Returns a new instance of Transformer.
6 7 8 9 |
# File 'lib/protobuf/active_record/transformer.rb', line 6 def initialize(callable, = {}) @callable = callable = end |
Instance Attribute Details
#callable ⇒ Object
Returns the value of attribute callable.
4 5 6 |
# File 'lib/protobuf/active_record/transformer.rb', line 4 def callable @callable end |
#options ⇒ Object
Returns the value of attribute options.
4 5 6 |
# File 'lib/protobuf/active_record/transformer.rb', line 4 def end |
Instance Method Details
#nullify?(proto) ⇒ Boolean
13 14 15 16 17 18 19 |
# File 'lib/protobuf/active_record/transformer.rb', line 13 def nullify?(proto) return false unless [:nullify_on] return false unless proto.field?(:nullify) && proto.nullify.is_a?(Array) return false if proto.nullify.empty? proto.nullify.include?([:nullify_on].to_s) end |