Class: Stupidedi::Config::CodeListConfig
- Includes:
- Inspect
- Defined in:
- lib/stupidedi/config/code_list_config.rb
Instance Method Summary collapse
- #at(id) ⇒ Object
- #defined_at?(id) ⇒ Boolean
-
#initialize ⇒ CodeListConfig
constructor
A new instance of CodeListConfig.
- #pretty_print(q) ⇒ void
- #register(id, &constructor) ⇒ Object
Methods included from Inspect
Constructor Details
#initialize ⇒ CodeListConfig
Returns a new instance of CodeListConfig.
7 8 9 |
# File 'lib/stupidedi/config/code_list_config.rb', line 7 def initialize @table = Hash.new end |
Instance Method Details
#at(id) ⇒ Object
21 22 23 |
# File 'lib/stupidedi/config/code_list_config.rb', line 21 def at(id) @table[id].call end |
#defined_at?(id) ⇒ Boolean
17 18 19 |
# File 'lib/stupidedi/config/code_list_config.rb', line 17 def defined_at?(id) @table.defined_at?(id) end |
#pretty_print(q) ⇒ void
This method returns an undefined value.
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/stupidedi/config/code_list_config.rb', line 26 def pretty_print(q) q.text "CodeListConfig" q.group(2, "(", ")") do q.breakable "" @table.keys.each do |e| unless q.current_group.first? q.text "," q.breakable end q.pp e end end end |
#register(id, &constructor) ⇒ Object
13 14 15 |
# File 'lib/stupidedi/config/code_list_config.rb', line 13 def register(id, &constructor) @table[id] = constructor end |