Class: RSpecExamples
- Inherits:
-
Object
- Object
- RSpecExamples
- Defined in:
- lib/rspec_examples.rb
Constant Summary collapse
- SPEC_PATH =
"#{Gem.path[0]}/gems/*/spec/**/*_spec.rb"
Instance Attribute Summary collapse
-
#examples ⇒ Object
readonly
Returns the value of attribute examples.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
Instance Method Summary collapse
-
#initialize(spec_path = SPEC_PATH) ⇒ RSpecExamples
constructor
A new instance of RSpecExamples.
- #search(word, type) ⇒ Object
Constructor Details
#initialize(spec_path = SPEC_PATH) ⇒ RSpecExamples
Returns a new instance of RSpecExamples.
5 6 7 |
# File 'lib/rspec_examples.rb', line 5 def initialize(spec_path=SPEC_PATH) @examples = Dir.glob(spec_path).map{|path| Example.new(path)} end |
Instance Attribute Details
#examples ⇒ Object (readonly)
Returns the value of attribute examples.
3 4 5 |
# File 'lib/rspec_examples.rb', line 3 def examples @examples end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
3 4 5 |
# File 'lib/rspec_examples.rb', line 3 def size @size end |
Instance Method Details
#search(word, type) ⇒ Object
9 10 11 |
# File 'lib/rspec_examples.rb', line 9 def search word, type @examples.select{|example| example.matches word, type } end |