Class: Muack::Modifier
- Inherits:
-
Struct
- Object
- Struct
- Muack::Modifier
- Defined in:
- lib/muack/modifier.rb
Instance Attribute Summary collapse
-
#defi ⇒ Object
Returns the value of attribute defi.
-
#mock ⇒ Object
Returns the value of attribute mock.
Instance Method Summary collapse
-
#object ⇒ Object
Public API.
-
#returns(val = nil, &block) ⇒ Object
Public API.
-
#times(number) ⇒ Object
Public API.
-
#with_any_args ⇒ Object
Public API.
Instance Attribute Details
#defi ⇒ Object
Returns the value of attribute defi
5 6 7 |
# File 'lib/muack/modifier.rb', line 5 def defi @defi end |
#mock ⇒ Object
Returns the value of attribute mock
5 6 7 |
# File 'lib/muack/modifier.rb', line 5 def mock @mock end |
Instance Method Details
#object ⇒ Object
Public API
30 31 32 |
# File 'lib/muack/modifier.rb', line 30 def object mock.object end |
#returns(val = nil, &block) ⇒ Object
Public API
13 14 15 |
# File 'lib/muack/modifier.rb', line 13 def returns val=nil, &block defi.block = block || lambda{ val } end |
#times(number) ⇒ Object
Public API
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/muack/modifier.rb', line 18 def times number if number >= 1 (number - 1).times{ mock.__mock_defis_push(defi) } elsif number == 0 mock.__mock_defis_pop(defi) else raise "What would you expect from calling a method #{number} times?" end self end |
#with_any_args ⇒ Object
Public API
7 8 9 10 |
# File 'lib/muack/modifier.rb', line 7 def with_any_args defi.args = [WithAnyArgs] self end |