Class: EverydayThorUtil::BuilderBuildLists::BuilderCommands
- Inherits:
-
Object
- Object
- EverydayThorUtil::BuilderBuildLists::BuilderCommands
- Defined in:
- lib/everyday_thor_util/builder.rb
Instance Method Summary collapse
- #[](name) ⇒ Object
- #[]=(name, command) ⇒ Object
- #commands ⇒ Object
- #delete(name) ⇒ Object
- #has_key?(name) ⇒ Boolean
-
#initialize(parent) ⇒ BuilderCommands
constructor
A new instance of BuilderCommands.
Constructor Details
#initialize(parent) ⇒ BuilderCommands
Returns a new instance of BuilderCommands.
143 144 145 146 |
# File 'lib/everyday_thor_util/builder.rb', line 143 def initialize(parent) @parent = parent @commands = {} end |
Instance Method Details
#[](name) ⇒ Object
152 153 154 |
# File 'lib/everyday_thor_util/builder.rb', line 152 def [](name) @commands[name.to_sym] end |
#[]=(name, command) ⇒ Object
156 157 158 159 160 161 162 163 164 |
# File 'lib/everyday_thor_util/builder.rb', line 156 def []=(name, command) if command.nil? delete(name) nil else @parent.helpers.delete(name) if @parent.helpers.has_key?(name) @commands[name.to_sym] = EverydayThorUtil::BuilderBuildItems::BuilderCommand.new(@parent, command., &command.body) end end |
#commands ⇒ Object
148 149 150 |
# File 'lib/everyday_thor_util/builder.rb', line 148 def commands @commands end |
#delete(name) ⇒ Object
170 171 172 |
# File 'lib/everyday_thor_util/builder.rb', line 170 def delete(name) @commands.delete(name.to_sym) end |
#has_key?(name) ⇒ Boolean
166 167 168 |
# File 'lib/everyday_thor_util/builder.rb', line 166 def has_key?(name) @commands.has_key?(name.to_sym) end |