Class: Fix::On Private
- Inherits:
-
Object
- Object
- Fix::On
- Defined in:
- lib/fix/on.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Wraps the target of challenge.
Instance Attribute Summary collapse
-
#challenges ⇒ Array
readonly
private
The list of challenges to apply.
-
#configuration ⇒ Hash
readonly
private
Settings.
-
#front_object ⇒ #object_id
readonly
private
The front object of the test.
-
#helpers ⇒ Hash
readonly
private
The list of helpers.
-
#results ⇒ Array
readonly
private
The list of collected results.
Instance Method Summary collapse
-
#context(&block) ⇒ Array
Add context method to the DSL, to build an isolated scope.
-
#initialize(front_object, results, challenges, helpers, configuration) ⇒ On
constructor
private
Initialize the on class.
-
#it(&spec) ⇒ Array
Add it method to the DSL.
-
#let(method_name, &block) ⇒ #object_id
List of results.
-
#on(method_name, *args, &block) ⇒ Array
Add on method to the DSL.
Constructor Details
#initialize(front_object, results, challenges, helpers, configuration) ⇒ On
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize the on class.
17 18 19 20 21 22 23 |
# File 'lib/fix/on.rb', line 17 def initialize(front_object, results, challenges, helpers, configuration) @front_object = front_object @results = results @challenges = challenges @helpers = helpers @configuration = configuration end |
Instance Attribute Details
#challenges ⇒ Array (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns The list of challenges to apply.
38 39 40 |
# File 'lib/fix/on.rb', line 38 def challenges @challenges end |
#configuration ⇒ Hash (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns Settings.
48 49 50 |
# File 'lib/fix/on.rb', line 48 def configuration @configuration end |
#front_object ⇒ #object_id (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns The front object of the test.
28 29 30 |
# File 'lib/fix/on.rb', line 28 def front_object @front_object end |
#helpers ⇒ Hash (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns The list of helpers.
43 44 45 |
# File 'lib/fix/on.rb', line 43 def helpers @helpers end |
#results ⇒ Array (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns The list of collected results.
33 34 35 |
# File 'lib/fix/on.rb', line 33 def results @results end |
Instance Method Details
#context(&block) ⇒ Array
Add context method to the DSL, to build an isolated scope.
112 113 114 115 116 117 118 119 120 |
# File 'lib/fix/on.rb', line 112 def context(*, &block) o = On.new(front_object, results, challenges, helpers.dup, configuration) Aw.fork! { o.instance_eval(&block) } end |
#it(&spec) ⇒ Array
Add it method to the DSL.
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/fix/on.rb', line 60 def it(&spec) i = It.new(front_object, challenges, helpers.dup) result = begin i.instance_eval(&spec) rescue Spectus::Result::Fail => f f end if configuration.fetch(:verbose, true) print result.to_char(configuration.fetch(:color, false)) end results << result end |
#let(method_name, &block) ⇒ #object_id
Returns List of results.
133 134 135 |
# File 'lib/fix/on.rb', line 133 def let(method_name, &block) helpers.update(method_name => block) end |