Class: Crspec::World
- Inherits:
-
Object
- Object
- Crspec::World
- Defined in:
- lib/crspec/dsl.rb
Instance Attribute Summary collapse
-
#example_groups ⇒ Object
readonly
Returns the value of attribute example_groups.
Class Method Summary collapse
Instance Method Summary collapse
- #freeze! ⇒ Object
- #frozen? ⇒ Boolean
-
#initialize ⇒ World
constructor
A new instance of World.
- #register(group) ⇒ Object
Constructor Details
#initialize ⇒ World
Returns a new instance of World.
17 18 19 20 |
# File 'lib/crspec/dsl.rb', line 17 def initialize @example_groups = [] @frozen = false end |
Instance Attribute Details
#example_groups ⇒ Object (readonly)
Returns the value of attribute example_groups.
15 16 17 |
# File 'lib/crspec/dsl.rb', line 15 def example_groups @example_groups end |
Class Method Details
.instance ⇒ Object
7 8 9 |
# File 'lib/crspec/dsl.rb', line 7 def self.instance @instance ||= new end |
.reset! ⇒ Object
11 12 13 |
# File 'lib/crspec/dsl.rb', line 11 def self.reset! @instance = new end |
Instance Method Details
#freeze! ⇒ Object
28 29 30 31 32 |
# File 'lib/crspec/dsl.rb', line 28 def freeze! @frozen = true @example_groups.freeze self end |
#frozen? ⇒ Boolean
34 35 36 |
# File 'lib/crspec/dsl.rb', line 34 def frozen? @frozen end |
#register(group) ⇒ Object
22 23 24 25 26 |
# File 'lib/crspec/dsl.rb', line 22 def register(group) raise Error, "Cannot register example groups after the run has started" if @frozen @example_groups << group end |