Class: Hippo::Screen::DefinitionList

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/hippo/screen.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#idsObject (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

Yields:

  • (definition)

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

#eachObject


40
41
42
# File 'lib/hippo/screen.rb', line 40

def each
    ids.each { |id| yield DEFINITIONS[id] }
end

#extend(id) {|definition| ... } ⇒ Object

Yields:

  • (definition)

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