Class: Light::Services::Variables

Inherits:
Object
  • Object
show all
Defined in:
lib/light/services/variables.rb

Instance Method Summary collapse

Constructor Details

#initializeVariables

Returns a new instance of Variables.



4
5
6
# File 'lib/light/services/variables.rb', line 4

def initialize
  @storage = {}
end

Instance Method Details

#add(key, variable) ⇒ Object



8
9
10
# File 'lib/light/services/variables.rb', line 8

def add(key, variable)
  @storage[key] = variable
end

#any?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/light/services/variables.rb', line 24

def any?
  !blank?
end

#blank?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/light/services/variables.rb', line 20

def blank?
  @storage.empty?
end

#delete(key) ⇒ Object



16
17
18
# File 'lib/light/services/variables.rb', line 16

def delete(key)
  @storage.delete(key)
end

#get(key) ⇒ Object



12
13
14
# File 'lib/light/services/variables.rb', line 12

def get(key)
  @storage[key]
end

#to_hashObject



28
29
30
# File 'lib/light/services/variables.rb', line 28

def to_hash
  @storage
end