Class: Crystalball::MapCompactor::ExampleContext
- Inherits:
-
Object
- Object
- Crystalball::MapCompactor::ExampleContext
- Defined in:
- lib/crystalball/map_compactor/example_context.rb
Overview
Class representing RSpec context data
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Returns the value of attribute address.
Instance Method Summary collapse
- #depth ⇒ Object
- #include?(example_id) ⇒ Boolean
-
#initialize(address) ⇒ ExampleContext
constructor
A new instance of ExampleContext.
- #parent ⇒ Object
Constructor Details
#initialize(address) ⇒ ExampleContext
Returns a new instance of ExampleContext.
9 10 11 |
# File 'lib/crystalball/map_compactor/example_context.rb', line 9 def initialize(address) @address = address end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
7 8 9 |
# File 'lib/crystalball/map_compactor/example_context.rb', line 7 def address @address end |
Instance Method Details
#depth ⇒ Object
24 25 26 |
# File 'lib/crystalball/map_compactor/example_context.rb', line 24 def depth @depth ||= address.split(':').size end |
#include?(example_id) ⇒ Boolean
20 21 22 |
# File 'lib/crystalball/map_compactor/example_context.rb', line 20 def include?(example_id) example_id =~ /\[#{address}[\:\]]/ end |
#parent ⇒ Object
13 14 15 16 17 18 |
# File 'lib/crystalball/map_compactor/example_context.rb', line 13 def parent @parent ||= begin parent_uid = address.split(':')[0..-2].join(':') parent_uid.empty? ? nil : self.class.new(parent_uid) end end |