Class: Shaf::Command::Test::Filter
- Inherits:
-
Object
- Object
- Shaf::Command::Test::Filter
- Defined in:
- lib/shaf/command/test/filter.rb
Constant Summary collapse
- None =
Filter.new('.*.rb')
Instance Attribute Summary collapse
-
#lines ⇒ Object
readonly
Returns the value of attribute lines.
-
#pattern ⇒ Object
readonly
Returns the value of attribute pattern.
Instance Method Summary collapse
-
#initialize(criteria) ⇒ Filter
constructor
A new instance of Filter.
- #match?(file) ⇒ Boolean
Constructor Details
#initialize(criteria) ⇒ Filter
Returns a new instance of Filter.
9 10 11 12 13 |
# File 'lib/shaf/command/test/filter.rb', line 9 def initialize(criteria) pattern, *lines = criteria.split(':') @lines = lines.map(&:to_i) @pattern = Regexp.new(pattern) end |
Instance Attribute Details
#lines ⇒ Object (readonly)
Returns the value of attribute lines.
7 8 9 |
# File 'lib/shaf/command/test/filter.rb', line 7 def lines @lines end |
#pattern ⇒ Object (readonly)
Returns the value of attribute pattern.
7 8 9 |
# File 'lib/shaf/command/test/filter.rb', line 7 def pattern @pattern end |
Instance Method Details
#match?(file) ⇒ Boolean
15 16 17 |
# File 'lib/shaf/command/test/filter.rb', line 15 def match?(file) pattern.match? file end |