Method: Ogre::RMaterial#method_missing

Defined in:
lib/shattered_view/ogrerb/rmaterial.rb

#method_missing(name, *args) ⇒ Object



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/shattered_view/ogrerb/rmaterial.rb', line 64

def method_missing(name, *args)
  # Check if the method is a setter

  if name.to_s[-1].chr == "="
    name = name.to_s[0...-1].to_sym
    # Set the instance variable to the sent variable

    ivar = "@#{ name }".to_sym
    instance_variable_set(ivar, args[0])
  else
    begin
      return eval("@#{name}")
    rescue StandardError => bang
      raise NoMethodError, "Rmaterial could not find the #{name} attribute: #{bang.message}"
    end
  end
end