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.
-
#klass ⇒ Object
Returns the value of attribute klass.
Instance Method Summary collapse
- #entries ⇒ Object
- #exclude?(value) ⇒ Boolean
- #include?(value) ⇒ Boolean
-
#initialize(klass, keys:) ⇒ AttributeInterface
constructor
A new instance of AttributeInterface.
- #inspect ⇒ Object
Constructor Details
#initialize(klass, keys:) ⇒ AttributeInterface
Returns a new instance of AttributeInterface.
5 6 7 8 9 |
# File 'lib/e_plat/resource/attribute_interface.rb', line 5 def initialize(klass, keys:) @klass, @keys = klass, keys add_to_instance! if keys.present? 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 |
#klass ⇒ Object
Returns the value of attribute klass.
3 4 5 |
# File 'lib/e_plat/resource/attribute_interface.rb', line 3 def klass @klass end |
Instance Method Details
#entries ⇒ Object
15 16 17 |
# File 'lib/e_plat/resource/attribute_interface.rb', line 15 def entries keys.map{|k| {k => klass.send(k)} }.inject(&:merge) end |
#exclude?(value) ⇒ Boolean
31 32 33 |
# File 'lib/e_plat/resource/attribute_interface.rb', line 31 def exclude?(value) !include? value end |
#include?(value) ⇒ Boolean
27 28 29 |
# File 'lib/e_plat/resource/attribute_interface.rb', line 27 def include?(value) entries.include? value end |
#inspect ⇒ Object
11 12 13 |
# File 'lib/e_plat/resource/attribute_interface.rb', line 11 def inspect "#<#{self.class} keys=#{keys.inspect}>" end |