Class: Stupidedi::Config::CodeListConfig

Inherits:
Object
  • Object
show all
Includes:
Inspect
Defined in:
lib/stupidedi/config/code_list_config.rb

Instance Method Summary collapse

Methods included from Inspect

#inspect

Constructor Details

#initializeCodeListConfig

Returns a new instance of CodeListConfig


10
11
12
# File 'lib/stupidedi/config/code_list_config.rb', line 10

def initialize
  @table = Hash.new
end

Instance Method Details

#at(id)


26
27
28
# File 'lib/stupidedi/config/code_list_config.rb', line 26

def at(id)
  @table[id].call
end

#customize(&block)


14
15
16
# File 'lib/stupidedi/config/code_list_config.rb', line 14

def customize(&block)
  tap(&block)
end

#defined_at?(id) ⇒ Boolean

Returns:

  • (Boolean)

22
23
24
# File 'lib/stupidedi/config/code_list_config.rb', line 22

def defined_at?(id)
  @table.defined_at?(id)
end

#pretty_print(q)

This method returns an undefined value.


31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/stupidedi/config/code_list_config.rb', line 31

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)


18
19
20
# File 'lib/stupidedi/config/code_list_config.rb', line 18

def register(id, &constructor)
  @table[id] = constructor
end