Sha256: 76e4ea914f744da7ef689f08773fdc90eaa392a63ac1f1534d10b00b8d54c95e

Contents?: true

Size: 460 Bytes

Versions: 2

Compression:

Stored size: 460 Bytes

Contents

require 'rprogram/extensions/hash'

module RProgram
  class OptionList < Hash

    def initialize(options={})
      super(options)
    end

    protected

    def method_missing(sym,*args,&block)
      name = sym.to_s

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

      super(sym,*args,&block)
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rprogram-0.1.2 lib/rprogram/option_list.rb
rprogram-0.1.3 lib/rprogram/option_list.rb