Class: Stockboy::Attribute
- Inherits:
-
Struct
- Object
- Struct
- Stockboy::Attribute
- Defined in:
- lib/stockboy/attribute.rb
Overview
Struct-like value object for holding mapping & translation details from input data fields
Instance Attribute Summary collapse
-
#from ⇒ Object
Returns the value of attribute from.
-
#ignore_condition ⇒ Object
Returns the value of attribute ignore_condition.
-
#to ⇒ Object
Returns the value of attribute to.
-
#translators ⇒ Object
Returns the value of attribute translators.
Instance Method Summary collapse
Instance Attribute Details
#from ⇒ Object
Returns the value of attribute from
6 7 8 |
# File 'lib/stockboy/attribute.rb', line 6 def from @from end |
#ignore_condition ⇒ Object
Returns the value of attribute ignore_condition
6 7 8 |
# File 'lib/stockboy/attribute.rb', line 6 def ignore_condition @ignore_condition end |
#to ⇒ Object
Returns the value of attribute to
6 7 8 |
# File 'lib/stockboy/attribute.rb', line 6 def to @to end |
#translators ⇒ Object
Returns the value of attribute translators
6 7 8 |
# File 'lib/stockboy/attribute.rb', line 6 def translators @translators end |
Instance Method Details
#ignore?(context) ⇒ Boolean
7 8 9 10 11 12 13 14 15 |
# File 'lib/stockboy/attribute.rb', line 7 def ignore?(context) if Symbol === ignore_condition context.public_send(to).public_send(ignore_condition) elsif ignore_condition.respond_to?(:call) ignore_condition.call(context) else !!(ignore_condition) end end |
#inspect ⇒ Object
17 18 19 20 21 22 |
# File 'lib/stockboy/attribute.rb', line 17 def inspect "#<Stockboy::Attribute to=#{to.inspect}, from=#{from.inspect}%s%s>" % [ (", translators=#{translators}" if translators), (", ignore=#{ignore_condition.inspect}" if ignore_condition) ] end |