Class: Bri::Matcher
- Inherits:
-
Object
- Object
- Bri::Matcher
- Defined in:
- lib/bri/matcher.rb
Instance Method Summary collapse
- #find ⇒ Object
-
#initialize(term) ⇒ Matcher
constructor
A new instance of Matcher.
- #subject ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(term) ⇒ Matcher
Returns a new instance of Matcher.
3 4 5 |
# File 'lib/bri/matcher.rb', line 3 def initialize( term ) @term = term end |
Instance Method Details
#find ⇒ Object
7 8 9 10 11 |
# File 'lib/bri/matcher.rb', line 7 def find search_instance = create_search_instance( subject, @term ) search_instance.search( type ) search_instance.matches end |
#subject ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/bri/matcher.rb', line 22 def subject case @term when /^[A-Z].*\./, /^\./ then :class_method when /^[A-Z].*#/, /^#/ then :instance_method when /^[A-Z][^.#]*/ then :module else :method end end |
#type ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/bri/matcher.rb', line 13 def type case @term when /^[A-Z]/ then :fully_qualified when /^[_a-z]/ then :unqualified when /^[.#]/ then :partially_qualified else :error end end |