Class: Configurations::Data

Inherits:
Object
  • Object
show all
Defined in:
lib/configurations/data.rb

Overview

Configuration is a blank object in order to allow configuration of various properties including keywords

Instance Method Summary collapse

Constructor Details

#initialize(data, reserved_method_validator = Validators::ReservedMethods.new) ⇒ Data

Returns a new instance of Data.


6
7
8
9
10
11
12
# File 'lib/configurations/data.rb', line 6

def initialize(
  data,
  reserved_method_validator = Validators::ReservedMethods.new
)
  @data = data
  @reserved_method_validator = reserved_method_validator
end

Instance Method Details

#[](key) ⇒ Object


14
15
16
# File 'lib/configurations/data.rb', line 14

def [](key)
  @data[key]
end

#[]=(key, value) ⇒ Object


18
19
20
21
22
# File 'lib/configurations/data.rb', line 18

def []=(key, value)
  @reserved_method_validator.validate!(key)

  @data[key] = value
end

#each(&block) ⇒ Object


32
33
34
# File 'lib/configurations/data.rb', line 32

def each(&block)
  @data.each(&block)
end

#fetch(key, &block) ⇒ Object


28
29
30
# File 'lib/configurations/data.rb', line 28

def fetch(key, &block)
  @data.fetch(key, &block)
end

#inspectObject


40
41
42
# File 'lib/configurations/data.rb', line 40

def inspect
  @data.inspect
end

#key?(key) ⇒ Boolean

Returns:

  • (Boolean)

24
25
26
# File 'lib/configurations/data.rb', line 24

def key?(key)
  @data.key?(key)
end

#reduce(acc, &block) ⇒ Object


36
37
38
# File 'lib/configurations/data.rb', line 36

def reduce(acc, &block)
  @data.reduce(acc, &block)
end