Class: LicenseFinder::License::Matcher
- Inherits:
-
Struct
- Object
- Struct
- LicenseFinder::License::Matcher
- Defined in:
- lib/license_finder/license/matcher.rb
Instance Attribute Summary collapse
-
#regexp ⇒ Object
Returns the value of attribute regexp.
Class Method Summary collapse
-
.from_regex(regexp) ⇒ Object
an alias for Matcher.new, for uniformity of constructors.
- .from_template(template) ⇒ Object
- .from_text(text) ⇒ Object
Instance Method Summary collapse
Instance Attribute Details
#regexp ⇒ Object
Returns the value of attribute regexp
5 6 7 |
# File 'lib/license_finder/license/matcher.rb', line 5 def regexp @regexp end |
Class Method Details
.from_regex(regexp) ⇒ Object
an alias for Matcher.new, for uniformity of constructors
15 16 17 |
# File 'lib/license_finder/license/matcher.rb', line 15 def self.from_regex(regexp) new(regexp) end |
.from_template(template) ⇒ Object
6 7 8 |
# File 'lib/license_finder/license/matcher.rb', line 6 def self.from_template(template) from_text(template.content) end |
.from_text(text) ⇒ Object
10 11 12 |
# File 'lib/license_finder/license/matcher.rb', line 10 def self.from_text(text) from_regex(Text.compile_to_regex(text)) end |
Instance Method Details
#matches_text?(text) ⇒ Boolean
19 20 21 |
# File 'lib/license_finder/license/matcher.rb', line 19 def matches_text?(text) !!(Text.normalize_punctuation(text) =~ regexp) end |