Module: Candle::Generators::Actions::ClassMethods
- Defined in:
- lib/candle/generators/actions.rb
Instance Method Summary collapse
-
#available_choices_for(component) ⇒ Object
Returns the list of available choices for the given component (including none).
-
#component_option(name, caption, options = {}) ⇒ Object
Defines a class option to allow a component to be chosen and add to component type list Also builds the available_choices hash of which component choices are supported component_option :test, “Testing framework”, :aliases => ‘-t’, :choices => [:bacon, :shoulda].
-
#component_types ⇒ Object
Returns the compiled list of component types which can be specified.
-
#require_arguments! ⇒ Object
Tell to Candle that for this Thor::Group is necessary a task to run.
-
#require_arguments? ⇒ Boolean
Return true if we need an arguments for our Thor::Group.
Instance Method Details
#available_choices_for(component) ⇒ Object
Returns the list of available choices for the given component (including none)
177 178 179 |
# File 'lib/candle/generators/actions.rb', line 177 def available_choices_for(component) @available_choices[component] + [:none] end |
#component_option(name, caption, options = {}) ⇒ Object
Defines a class option to allow a component to be chosen and add to component type list Also builds the available_choices hash of which component choices are supported component_option :test, “Testing framework”, :aliases => ‘-t’, :choices => [:bacon, :shoulda]
154 155 156 157 158 159 |
# File 'lib/candle/generators/actions.rb', line 154 def component_option(name, , = {}) (@component_types ||= []) << name # TODO use ordered hash and combine with choices below (@available_choices ||= Hash.new)[name] = [:choices] description = "The #{} component (#{[:choices].join(', ')}, none)" class_option name, :default => [:default] || [:choices].first, :aliases => [:aliases], :desc => description end |
#component_types ⇒ Object
Returns the compiled list of component types which can be specified
172 173 174 |
# File 'lib/candle/generators/actions.rb', line 172 def component_types @component_types end |
#require_arguments! ⇒ Object
Tell to Candle that for this Thor::Group is necessary a task to run
162 163 164 |
# File 'lib/candle/generators/actions.rb', line 162 def require_arguments! @require_arguments = true end |
#require_arguments? ⇒ Boolean
Return true if we need an arguments for our Thor::Group
167 168 169 |
# File 'lib/candle/generators/actions.rb', line 167 def require_arguments? @require_arguments end |