Module: TemplateBuilder::App::Command::ClassMethods
- Defined in:
- lib/template_builder/app/command.rb
Instance Method Summary collapse
- #description(*args) ⇒ Object
- #option(*args, &block) ⇒ Object
- #options ⇒ Object
- #parameter(*args) ⇒ Object
- #parameters ⇒ Object
- #summary(*args) ⇒ Object
- #synopsis(*args) ⇒ Object
Instance Method Details
#description(*args) ⇒ Object
152 153 154 155 |
# File 'lib/template_builder/app/command.rb', line 152 def description( *args ) @description = args.join("\n") unless args.empty? @description end |
#option(*args, &block) ⇒ Object
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
# File 'lib/template_builder/app/command.rb', line 162 def option( *args, &block ) args.flatten! block = args.pop if block.nil? and Proc === args.last if block args.each { |val| next unless val.instance_of? String next unless val =~ %r/^--(\w+)/ args << "__#$1" define_method(args.last.to_sym, &block) << args break } else << (args.length > 1 ? args : args.first ) end end |
#options ⇒ Object
200 201 202 |
# File 'lib/template_builder/app/command.rb', line 200 def @options ||= [] end |
#parameter(*args) ⇒ Object
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
# File 'lib/template_builder/app/command.rb', line 179 def parameter(*args) args.flatten! block = args.pop if block.nil? and Proc === args.last if block args.each { |val| next unless val.instance_of? String next unless val =~ %r/^--(\w+)/ args << "__#$1" define_method(args.last.to_sym, &block) parameters << args break } else parameters << (args.length > 1 ? args : args.first ) end end |
#parameters ⇒ Object
196 197 198 |
# File 'lib/template_builder/app/command.rb', line 196 def parameters @parameters ||= [] end |
#summary(*args) ⇒ Object
157 158 159 160 |
# File 'lib/template_builder/app/command.rb', line 157 def summary( *args ) @summary = args.join("\n") unless args.empty? @summary end |
#synopsis(*args) ⇒ Object
147 148 149 150 |
# File 'lib/template_builder/app/command.rb', line 147 def synopsis( *args ) @synopsis = args.join("\n") unless args.empty? @synopsis end |