class RProgram::OptionList

Public Class Methods

new(options={}) click to toggle source

Creates a new OptionList object.

@param [Hash{Symbol => String}] options

The options to start with.
Calls superclass method
# File lib/rprogram/option_list.rb, line 10
def initialize(options={})
  super(options)
end

Protected Instance Methods

method_missing(sym,*args,&block) click to toggle source

Provides transparent access to the options within the option list.

@example

opt_list = OptionList.new(:name => 'test')
opt_list.name
# => "test"
Calls superclass method
# File lib/rprogram/option_list.rb, line 24
def method_missing(sym,*args,&block)
  name = sym.to_s

  unless block
    if (name =~ /=$/ && args.length == 1)
      return self[name.chop.to_sym] = args.first
    elsif args.empty?
      return self[sym]
    end
  end

  return super(sym,*args,&block)
end