Module: Amrita2::Util::OptionSupport
- Included in:
- Core::DefaultFilter, Filters::Each, Filters::ToHash, Option, REXMLConverter
- Defined in:
- lib/amrita2/template.rb
Overview
:nodoc: all
Instance Attribute Summary collapse
-
#opt ⇒ Object
readonly
Returns the value of attribute opt.
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &block) ⇒ Object
296 297 298 299 300 301 302 |
# File 'lib/amrita2/template.rb', line 296 def method_missing(sym, *args, &block) if @opt and @opt.has_key?(sym) @opt[sym] else super end end |
Instance Attribute Details
#opt ⇒ Object (readonly)
Returns the value of attribute opt.
277 278 279 |
# File 'lib/amrita2/template.rb', line 277 def opt @opt end |
Instance Method Details
#[](key) ⇒ Object
292 293 294 |
# File 'lib/amrita2/template.rb', line 292 def [](key) @opt[key] end |
#parse_opt(*args) ⇒ Object
278 279 280 281 282 283 284 285 286 287 288 289 290 |
# File 'lib/amrita2/template.rb', line 278 def parse_opt(*args) @opt = {} hash = args.last if hash.kind_of?(Hash) @opt.merge!(hash) args.pop end args.each do |key| @opt[key] = key end @opt end |