Class: RR::DoubleDefinitions::DoubleDefinitionCreator
- Inherits:
-
Object
- Object
- RR::DoubleDefinitions::DoubleDefinitionCreator
- Defined in:
- lib/rr/double_definitions/double_definition_creator.rb
Overview
:nodoc
Direct Known Subclasses
Defined Under Namespace
Modules: StrategyExecutionMethods, StrategySetupMethods Classes: DoubleDefinitionCreatorError
Constant Summary collapse
- NO_SUBJECT =
Object.new
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#definition ⇒ Object
readonly
Returns the value of attribute definition.
-
#handler ⇒ Object
readonly
Returns the value of attribute handler.
-
#implementation_strategy ⇒ Object
readonly
Returns the value of attribute implementation_strategy.
-
#method_name ⇒ Object
readonly
Returns the value of attribute method_name.
-
#scope_strategy ⇒ Object
readonly
Returns the value of attribute scope_strategy.
-
#subject ⇒ Object
readonly
Returns the value of attribute subject.
-
#verification_strategy ⇒ Object
readonly
Returns the value of attribute verification_strategy.
Class Method Summary collapse
- .register_implementation_strategy_class(strategy_class, method_name) ⇒ Object
- .register_scope_strategy_class(strategy_class, method_name) ⇒ Object
- .register_verification_strategy_class(strategy_class, method_name) ⇒ Object
Instance Method Summary collapse
-
#initialize ⇒ DoubleDefinitionCreator
constructor
A new instance of DoubleDefinitionCreator.
- #root_subject ⇒ Object
Methods included from StrategyExecutionMethods
Methods included from StrategySetupMethods
Methods included from Space::Reader
Constructor Details
#initialize ⇒ DoubleDefinitionCreator
Returns a new instance of DoubleDefinitionCreator.
65 66 67 68 69 |
# File 'lib/rr/double_definitions/double_definition_creator.rb', line 65 def initialize @verification_strategy = nil @implementation_strategy = Strategies::Implementation::Reimplementation.new(self) @scope_strategy = Strategies::Scope::Instance.new(self) end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
54 55 56 |
# File 'lib/rr/double_definitions/double_definition_creator.rb', line 54 def args @args end |
#definition ⇒ Object (readonly)
Returns the value of attribute definition.
54 55 56 |
# File 'lib/rr/double_definitions/double_definition_creator.rb', line 54 def definition @definition end |
#handler ⇒ Object (readonly)
Returns the value of attribute handler.
54 55 56 |
# File 'lib/rr/double_definitions/double_definition_creator.rb', line 54 def handler @handler end |
#implementation_strategy ⇒ Object (readonly)
Returns the value of attribute implementation_strategy.
54 55 56 |
# File 'lib/rr/double_definitions/double_definition_creator.rb', line 54 def implementation_strategy @implementation_strategy end |
#method_name ⇒ Object (readonly)
Returns the value of attribute method_name.
54 55 56 |
# File 'lib/rr/double_definitions/double_definition_creator.rb', line 54 def method_name @method_name end |
#scope_strategy ⇒ Object (readonly)
Returns the value of attribute scope_strategy.
54 55 56 |
# File 'lib/rr/double_definitions/double_definition_creator.rb', line 54 def scope_strategy @scope_strategy end |
#subject ⇒ Object (readonly)
Returns the value of attribute subject.
54 55 56 |
# File 'lib/rr/double_definitions/double_definition_creator.rb', line 54 def subject @subject end |
#verification_strategy ⇒ Object (readonly)
Returns the value of attribute verification_strategy.
54 55 56 |
# File 'lib/rr/double_definitions/double_definition_creator.rb', line 54 def verification_strategy @verification_strategy end |
Class Method Details
.register_implementation_strategy_class(strategy_class, method_name) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/rr/double_definitions/double_definition_creator.rb', line 21 def register_implementation_strategy_class(strategy_class, method_name) class_eval((<<-CLASS), __FILE__, __LINE__ + 1) def #{method_name}(subject=NO_SUBJECT, method_name=nil, &definition_eval_block) add_strategy(subject, method_name, definition_eval_block) do self.implementation_strategy = #{strategy_class.name}.new(self) end end CLASS class_eval((<<-CLASS), __FILE__, __LINE__ + 1) def #{method_name}!(method_name=nil, &definition_eval_block) #{method_name}(Object.new, method_name, &definition_eval_block) end CLASS end |
.register_scope_strategy_class(strategy_class, method_name) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/rr/double_definitions/double_definition_creator.rb', line 37 def register_scope_strategy_class(strategy_class, method_name) class_eval((<<-CLASS), __FILE__, __LINE__ + 1) def #{method_name}(subject=NO_SUBJECT, method_name=nil, &definition_eval_block) add_strategy(subject, method_name, definition_eval_block) do self.scope_strategy = #{strategy_class.name}.new(self) end end CLASS class_eval((<<-CLASS), __FILE__, __LINE__ + 1) def #{method_name}!(method_name=nil, &definition_eval_block) #{method_name}(Object.new, method_name, &definition_eval_block) end CLASS end |
.register_verification_strategy_class(strategy_class, method_name) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/rr/double_definitions/double_definition_creator.rb', line 5 def register_verification_strategy_class(strategy_class, method_name) class_eval((<<-CLASS), __FILE__, __LINE__ + 1) def #{method_name}(subject=NO_SUBJECT, method_name=nil, &definition_eval_block) add_strategy(subject, method_name, definition_eval_block) do self.verification_strategy = #{strategy_class.name}.new(self) end end CLASS class_eval((<<-CLASS), __FILE__, __LINE__ + 1) def #{method_name}!(method_name=nil, &definition_eval_block) #{method_name}(Object.new, method_name, &definition_eval_block) end CLASS end |
Instance Method Details
#root_subject ⇒ Object
71 72 73 |
# File 'lib/rr/double_definitions/double_definition_creator.rb', line 71 def root_subject subject end |