Class: LazyRails::CommandBuilder
- Inherits:
-
Object
- Object
- LazyRails::CommandBuilder
- Defined in:
- lib/lazy_rails.rb
Instance Attribute Summary collapse
-
#app_name ⇒ Object
Returns the value of attribute app_name.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #base_command ⇒ Object
- #build ⇒ Object
- #build_options ⇒ Object
-
#initialize(app_name) ⇒ CommandBuilder
constructor
A new instance of CommandBuilder.
Constructor Details
#initialize(app_name) ⇒ CommandBuilder
Returns a new instance of CommandBuilder.
37 38 39 40 |
# File 'lib/lazy_rails.rb', line 37 def initialize(app_name) @app_name = app_name @options = [] end |
Instance Attribute Details
#app_name ⇒ Object
Returns the value of attribute app_name.
35 36 37 |
# File 'lib/lazy_rails.rb', line 35 def app_name @app_name end |
#options ⇒ Object
Returns the value of attribute options.
35 36 37 |
# File 'lib/lazy_rails.rb', line 35 def @options end |
Instance Method Details
#base_command ⇒ Object
56 57 58 |
# File 'lib/lazy_rails.rb', line 56 def base_command ["rails new #{app_name}"] end |
#build ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/lazy_rails.rb', line 42 def build if block_given? yield self end command = base_command + command.compact.join(" ").strip end |
#build_options ⇒ Object
50 51 52 53 54 |
# File 'lib/lazy_rails.rb', line 50 def .flatten.map do |option| NewCommand::OPTIONS[option] end end |