Class: Light::Services::Variables
- Inherits:
-
Object
- Object
- Light::Services::Variables
- Defined in:
- lib/light/services/variables.rb
Instance Method Summary collapse
- #add(key, variable) ⇒ Object
- #any? ⇒ Boolean
- #blank? ⇒ Boolean
- #delete(key) ⇒ Object
- #get(key) ⇒ Object
-
#initialize ⇒ Variables
constructor
A new instance of Variables.
- #to_hash ⇒ Object
Constructor Details
#initialize ⇒ Variables
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
24 25 26 |
# File 'lib/light/services/variables.rb', line 24 def any? !blank? end |
#blank? ⇒ 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_hash ⇒ Object
28 29 30 |
# File 'lib/light/services/variables.rb', line 28 def to_hash @storage end |