Class: StaticStruct::Structure
- Inherits:
-
Object
- Object
- StaticStruct::Structure
- Includes:
- Enumerable
- Defined in:
- lib/static_struct/structure.rb
Instance Attribute Summary collapse
-
#static_methods ⇒ Object
readonly
Returns the value of attribute static_methods.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #each ⇒ Object
-
#initialize(hash) ⇒ Structure
constructor
A new instance of Structure.
- #to_s ⇒ Object
Constructor Details
#initialize(hash) ⇒ Structure
Returns a new instance of Structure.
9 10 11 12 |
# File 'lib/static_struct/structure.rb', line 9 def initialize(hash) @static_methods = SortedSet.new define_structure(self, hash) end |
Instance Attribute Details
#static_methods ⇒ Object (readonly)
Returns the value of attribute static_methods.
7 8 9 |
# File 'lib/static_struct/structure.rb', line 7 def static_methods @static_methods end |
Instance Method Details
#==(other) ⇒ Object
22 23 24 |
# File 'lib/static_struct/structure.rb', line 22 def ==(other) current_state == other.current_state end |
#each ⇒ Object
26 27 28 29 30 |
# File 'lib/static_struct/structure.rb', line 26 def each static_methods.each do |m| yield m, public_send(m) end end |
#to_s ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/static_struct/structure.rb', line 14 def to_s joined_line = [self.class, current_state].map(&:to_s).select do |str| str.size > 0 end.join(' ') "#<#{joined_line}>" end |