Class: Figure::Figurine
- Inherits:
-
Hash
- Object
- Hash
- Figure::Figurine
- Includes:
- DepartmentStore, Store, Singleton
- Defined in:
- lib/figure/figurine.rb
Class Attribute Summary collapse
-
.label ⇒ Object
Returns the value of attribute label.
-
.with_data ⇒ Object
Returns the value of attribute with_data.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Figurine
constructor
A new instance of Figurine.
Methods included from Store
#[]=, #default, #default_store, #has_key?, #merge!
Constructor Details
#initialize ⇒ Figurine
Returns a new instance of Figurine.
30 31 32 33 34 35 36 37 38 |
# File 'lib/figure/figurine.rb', line 30 def initialize h = self.class.with_data || {} (h.delete(:default) || h.delete(:gaston)).tap do |data| self[:default] = new_store :default, data, self.class if data end merge! h end |
Class Attribute Details
.label ⇒ Object
Returns the value of attribute label.
14 15 16 |
# File 'lib/figure/figurine.rb', line 14 def label @label end |
.with_data ⇒ Object
Returns the value of attribute with_data.
14 15 16 |
# File 'lib/figure/figurine.rb', line 14 def with_data @with_data end |
Class Method Details
.default_type ⇒ Object
16 17 18 |
# File 'lib/figure/figurine.rb', line 16 def default_type @default_type ||= label.include? 'Default' end |
.pattern ⇒ Object
20 21 22 |
# File 'lib/figure/figurine.rb', line 20 def pattern @pattern ||= label.gsub 'Default', '[^:]+' end |
.with(data) ⇒ Object
24 25 26 |
# File 'lib/figure/figurine.rb', line 24 def with(data) self.tap { |s| s.with_data = data } end |