Class: Rordash::Chain

Inherits:
Object
  • Object
show all
Defined in:
lib/rordash/chain.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Chain



5
6
7
# File 'lib/rordash/chain.rb', line 5

def initialize(value)
  @value = value
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



3
4
5
# File 'lib/rordash/chain.rb', line 3

def value
  @value
end

Instance Method Details

#deep_compactObject



21
22
23
24
25
# File 'lib/rordash/chain.rb', line 21

def deep_compact
  @value = HashUtil.deep_compact(@value)

  self
end

#merge(other) ⇒ Object



32
33
34
35
# File 'lib/rordash/chain.rb', line 32

def merge(other)
  @value = @value.merge(other)
  self
end

#pick(paths) ⇒ Object



27
28
29
30
# File 'lib/rordash/chain.rb', line 27

def pick(paths)
  @value = HashUtil.pick(@value, paths)
  self
end

#set(path, value) ⇒ Object



37
38
39
40
# File 'lib/rordash/chain.rb', line 37

def set(path, value)
  HashUtil.set(@value, path, value)
  self
end

#to_hObject



9
10
11
12
13
# File 'lib/rordash/chain.rb', line 9

def to_h
  @value = HashUtil.from_string(@value)

  self
end

#to_strObject



15
16
17
18
19
# File 'lib/rordash/chain.rb', line 15

def to_str
  @value = HashUtil.to_str(@value)

  self
end