Class: Quarry::Stub
Defined Under Namespace
Instance Attribute Summary collapse
-
#object ⇒ Object
readonly
Returns the value of attribute object.
Instance Method Summary collapse
- #__table__ ⇒ Object
-
#initialize ⇒ Stub
constructor
A new instance of Stub.
- #method_missing(meth, *args, &block) ⇒ Object
Constructor Details
#initialize ⇒ Stub
Returns a new instance of Stub.
7 8 9 10 |
# File 'lib/quarry/stub.rb', line 7 def initialize super() @table = {} end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/quarry/stub.rb', line 16 def method_missing(meth, *args, &block) table = @table interface = [meth, args, block_given?] table[interface] = nil define_method(meth) do |*args| table[interface] end Setter.new(table, interface) end |
Instance Attribute Details
#object ⇒ Object (readonly)
Returns the value of attribute object.
5 6 7 |
# File 'lib/quarry/stub.rb', line 5 def object @object end |
Instance Method Details
#__table__ ⇒ Object
13 |
# File 'lib/quarry/stub.rb', line 13 def __table__ ; @table ; end |