Class: Hippo::Screen::DefinitionList
- Inherits:
-
Object
- Object
- Hippo::Screen::DefinitionList
- Includes:
- Enumerable
- Defined in:
- lib/hippo/screen.rb
Instance Attribute Summary collapse
-
#ids ⇒ Object
readonly
Returns the value of attribute ids.
Instance Method Summary collapse
- #define(id) {|definition| ... } ⇒ Object
- #each ⇒ Object
- #extend(id) {|definition| ... } ⇒ Object
-
#initialize(extension_id) ⇒ DefinitionList
constructor
A new instance of DefinitionList.
Constructor Details
#initialize(extension_id) ⇒ DefinitionList
Returns a new instance of DefinitionList.
22 23 24 25 |
# File 'lib/hippo/screen.rb', line 22 def initialize(extension_id) @ids = [] @extension_id = extension_id end |
Instance Attribute Details
#ids ⇒ Object (readonly)
Returns the value of attribute ids.
18 19 20 |
# File 'lib/hippo/screen.rb', line 18 def ids @ids end |
Instance Method Details
#define(id) {|definition| ... } ⇒ Object
27 28 29 30 31 |
# File 'lib/hippo/screen.rb', line 27 def define(id) ids.push(id) definition = (DEFINITIONS[id] ||= Definition.new(id, @extension_id)) yield definition end |
#each ⇒ Object
40 41 42 |
# File 'lib/hippo/screen.rb', line 40 def each ids.each { |id| yield DEFINITIONS[id] } end |
#extend(id) {|definition| ... } ⇒ Object
33 34 35 36 37 38 |
# File 'lib/hippo/screen.rb', line 33 def extend(id) ids.push(id) definition = DEFINITIONS[id] definition.extension_id = @extension_id yield definition if block_given? end |