Class: RSpecExamples

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec_examples.rb

Constant Summary collapse

SPEC_PATH =
"#{Gem.path[0]}/gems/*/spec/**/*_spec.rb"

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#examplesObject (readonly)

Returns the value of attribute examples.



3
4
5
# File 'lib/rspec_examples.rb', line 3

def examples
  @examples
end

#sizeObject (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