Module: Main::Base::DSL
- Included in:
- Main::Base
- Defined in:
- lib/main/base.rb
Instance Method Summary collapse
- #argument(*a, &b) ⇒ Object (also: #arg)
- #default_options! ⇒ Object
- #environment(*a, &b) ⇒ Object (also: #env)
- #keyword(*a, &b) ⇒ Object (also: #kw)
- #mode(name, &b) ⇒ Object
- #option(*a, &b) ⇒ Object (also: #opt, #switch)
- #parameter(*a, &b) ⇒ Object
Instance Method Details
#argument(*a, &b) ⇒ Object Also known as: arg
147 148 149 |
# File 'lib/main/base.rb', line 147 def argument *a, &b (parameters << Parameter.create(:argument, *a, &b)).last end |
#default_options! ⇒ Object
143 144 145 |
# File 'lib/main/base.rb', line 143 def option 'help', 'h' unless parameters.has_option?('help', 'h') end |
#environment(*a, &b) ⇒ Object Also known as: env
157 158 159 |
# File 'lib/main/base.rb', line 157 def environment *a, &b (parameters << Parameter.create(:environment, *a, &b)).last end |
#keyword(*a, &b) ⇒ Object Also known as: kw
152 153 154 |
# File 'lib/main/base.rb', line 152 def keyword *a, &b (parameters << Parameter.create(:keyword, *a, &b)).last end |
#mode(name, &b) ⇒ Object
162 163 164 165 166 167 168 169 |
# File 'lib/main/base.rb', line 162 def mode name, &b klass = create context do mode_name name module_eval &b if b end modes.add klass end |