Class: Summoner::Attributes
Instance Method Summary collapse
Methods inherited from Hash
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'lib/summoner/attributes.rb', line 3 def method_missing(name, *args, &block) if name == :has_one self[args.first] = Summoner.invoke args.first elsif name == :has_many self[args.first] = [Summoner.invoke(args.first)] else self[name.to_sym] = args end end |