Class: EverydayThorUtil::BuilderBuildLists::BuilderHelpers
- Inherits:
-
Object
- Object
- EverydayThorUtil::BuilderBuildLists::BuilderHelpers
- Defined in:
- lib/everyday_thor_util/builder.rb
Instance Method Summary collapse
- #[](name) ⇒ Object
- #[]=(name, body) ⇒ Object
- #delete(name) ⇒ Object
- #has_key?(name) ⇒ Boolean
- #helpers ⇒ Object
-
#initialize(parent) ⇒ BuilderHelpers
constructor
A new instance of BuilderHelpers.
Constructor Details
#initialize(parent) ⇒ BuilderHelpers
Returns a new instance of BuilderHelpers.
80 81 82 83 |
# File 'lib/everyday_thor_util/builder.rb', line 80 def initialize(parent) @parent = parent @helpers = {} end |
Instance Method Details
#[](name) ⇒ Object
89 90 91 |
# File 'lib/everyday_thor_util/builder.rb', line 89 def [](name) @helpers[name.to_sym] end |
#[]=(name, body) ⇒ Object
93 94 95 96 97 98 99 100 101 |
# File 'lib/everyday_thor_util/builder.rb', line 93 def []=(name, body) if body.nil? self.delete(name) nil else @parent.commands.delete(name) if @parent.respond_to?(:commands) && @parent.commands.has_key?(name) @helpers[name.to_sym] = body end end |
#delete(name) ⇒ Object
107 108 109 |
# File 'lib/everyday_thor_util/builder.rb', line 107 def delete(name) @helpers.delete(name.to_sym) end |
#has_key?(name) ⇒ Boolean
103 104 105 |
# File 'lib/everyday_thor_util/builder.rb', line 103 def has_key?(name) @helpers.has_key?(name.to_sym) end |
#helpers ⇒ Object
85 86 87 |
# File 'lib/everyday_thor_util/builder.rb', line 85 def helpers @helpers end |