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.


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

def initialize
  @table = Hash.new
end

Instance Method Details

#at(id)


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

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

#customize(&block)


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

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

#defined_at?(id) ⇒ Boolean

Returns:

  • (Boolean)

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

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

#pretty_print(q)

This method returns an undefined value.


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

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)


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

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