class RubyInstaller::Build::Openstruct

Public Class Methods

new(hash={}) click to toggle source
# File lib/ruby_installer/build/openstruct.rb, line 4
def initialize(hash={})
  @__attrs = {}
  hash.each do |k,v|
    send("#{k}=", v)
  end
end

Public Instance Methods

method_missing(meth, *args) click to toggle source
Calls superclass method
# File lib/ruby_installer/build/openstruct.rb, line 11
def method_missing(meth, *args)
  if meth=~/\A(.*)=\z/ && args.length == 1
    attr = $1
    self.class.class_eval do
      define_method(attr) do
        @__attrs[attr]
      end
      define_method(meth) do |val|
        @__attrs[attr] = val
      end
    end
    @__attrs[attr] = args.first
  else
    super
  end
end