Class: Locd::Pattern::Label
- Inherits:
-
Locd::Pattern
- Object
- Locd::Pattern
- Locd::Pattern::Label
- Defined in:
- lib/locd/pattern.rb
Overview
A Locd::Pattern that matches against Agent labels with "glob-style" matching (like the lunchy gem).
Right now only handles the *
wildcard!
Instance Attribute Summary collapse
-
#regexp ⇒ Regexp
readonly
Label Regexp used by #match?.
-
#string ⇒ attr_type
readonly
TODO document
string
attribute.
Attributes inherited from Locd::Pattern
Instance Method Summary collapse
-
#initialize(source, full: false, ignore_case: false) ⇒ Label
constructor
Instantiate a new
Locd::Pattern::Label
. -
#match?(agent) ⇒ Boolean
See if this patten matches an agent.
Methods inherited from Locd::Pattern
Constructor Details
#initialize(source, full: false, ignore_case: false) ⇒ Label
Instantiate a new Locd::Pattern::Label
.
137 138 139 140 141 142 |
# File 'lib/locd/pattern.rb', line 137 def initialize source, full: false, ignore_case: false super source @regexp = Locd::Label.regexp_for_glob source, full: full, ignore_case: ignore_case end |
Instance Attribute Details
#regexp ⇒ Regexp (readonly)
Label Regexp used by #match?
121 122 123 |
# File 'lib/locd/pattern.rb', line 121 def regexp @regexp end |
#string ⇒ attr_type (readonly)
TODO document string
attribute.
114 115 116 |
# File 'lib/locd/pattern.rb', line 114 def string @string end |
Instance Method Details
#match?(agent) ⇒ Boolean
See if this patten matches an agent.
153 154 155 |
# File 'lib/locd/pattern.rb', line 153 def match? agent agent.label =~ regexp end |