Class: Panda::SubjectGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/panda/build.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object (private)

Returns a new Subject whose name attribute is set to the missing method’s name.

sg = Panda::SubjectGenerator.new
sg.foo -> #<Panda::Subject:0x8260acc @name=:foo>
sg.bar -> #<Panda::Subject:0x825f398 @name=:bar>


24
25
26
# File 'lib/panda/build.rb', line 24

def method_missing(method, *args) # :doc:
  Subject.new method
end

Instance Method Details

#[](sub_name) ⇒ Object

Returns a new Subject whose name attribute is set to sub_name.

sg = Panda::SubjectGenerator.new
sg[:foo]  -> #<Panda::Subject:0x8260acc @name=:foo>
sg['bar'] -> #<Panda::Subject:0x825f398 @name="bar">


11
12
13
# File 'lib/panda/build.rb', line 11

def [](sub_name)
  Subject.new sub_name
end