Class: Yuriita::Configuration

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/yuriita/configuration.rb

Constant Summary collapse

EMPTY_STRING =
"".freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(definitions, default_input: EMPTY_STRING) ⇒ Configuration

Returns a new instance of Configuration.



8
9
10
11
# File 'lib/yuriita/configuration.rb', line 8

def initialize(definitions, default_input: EMPTY_STRING)
  @definitions = definitions
  @default_input = default_input
end

Instance Attribute Details

#default_inputObject (readonly)

Returns the value of attribute default_input.



6
7
8
# File 'lib/yuriita/configuration.rb', line 6

def default_input
  @default_input
end

Instance Method Details

#each(&block) ⇒ Object



17
18
19
20
21
# File 'lib/yuriita/configuration.rb', line 17

def each(&block)
  block or return enum_for(__method__) { size }
  definitions.each_value(&block)
  self
end

#find_definition(key) ⇒ Object



13
14
15
# File 'lib/yuriita/configuration.rb', line 13

def find_definition(key)
  definitions.fetch(key)
end

#sizeObject



23
24
25
# File 'lib/yuriita/configuration.rb', line 23

def size
  definitions.size
end