Class: EPlat::AttributeInterface
- Inherits:
-
Object
- Object
- EPlat::AttributeInterface
- Defined in:
- lib/e_plat/resource/attribute_interface.rb
Instance Attribute Summary collapse
-
#keys ⇒ Object
Returns the value of attribute keys.
-
#parent ⇒ Object
Returns the value of attribute parent.
Instance Method Summary collapse
- #entries ⇒ Object
- #exclude?(value) ⇒ Boolean
- #include?(value) ⇒ Boolean
-
#initialize(parent, keys:) ⇒ AttributeInterface
constructor
A new instance of AttributeInterface.
- #inspect ⇒ Object
Constructor Details
#initialize(parent, keys:) ⇒ AttributeInterface
Returns a new instance of AttributeInterface.
5 6 7 8 |
# File 'lib/e_plat/resource/attribute_interface.rb', line 5 def initialize(parent, keys:) @parent, @keys = parent, keys add_convenience_methods end |
Instance Attribute Details
#keys ⇒ Object
Returns the value of attribute keys.
3 4 5 |
# File 'lib/e_plat/resource/attribute_interface.rb', line 3 def keys @keys end |
#parent ⇒ Object
Returns the value of attribute parent.
3 4 5 |
# File 'lib/e_plat/resource/attribute_interface.rb', line 3 def parent @parent end |
Instance Method Details
#entries ⇒ Object
14 15 16 |
# File 'lib/e_plat/resource/attribute_interface.rb', line 14 def entries keys.map{|k| {k => parent.send(k)} }.inject(&:merge) end |
#exclude?(value) ⇒ Boolean
30 31 32 |
# File 'lib/e_plat/resource/attribute_interface.rb', line 30 def exclude?(value) !include? value end |
#include?(value) ⇒ Boolean
26 27 28 |
# File 'lib/e_plat/resource/attribute_interface.rb', line 26 def include?(value) entries.include? value end |
#inspect ⇒ Object
10 11 12 |
# File 'lib/e_plat/resource/attribute_interface.rb', line 10 def inspect "#<#{self.class} keys=#{keys.inspect}>" end |