Class: Hackle::TargetMatchType
- Inherits:
-
Object
- Object
- Hackle::TargetMatchType
- Defined in:
- lib/hackle/internal/model/target.rb
Constant Summary collapse
- MATCH =
new('MATCH')
- NOT_MATCH =
new('NOT MATCH')
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
- .from_or_nil(name) ⇒ TargetMatchType?
- .matches(type, matches) ⇒ boolean
- .values ⇒ Array<TargetMatchType>
Instance Method Summary collapse
-
#initialize(name) ⇒ TargetMatchType
constructor
A new instance of TargetMatchType.
- #to_s ⇒ Object
Constructor Details
#initialize(name) ⇒ TargetMatchType
Returns a new instance of TargetMatchType.
116 117 118 |
# File 'lib/hackle/internal/model/target.rb', line 116 def initialize(name) @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
113 114 115 |
# File 'lib/hackle/internal/model/target.rb', line 113 def name @name end |
Class Method Details
.from_or_nil(name) ⇒ TargetMatchType?
134 135 136 |
# File 'lib/hackle/internal/model/target.rb', line 134 def self.from_or_nil(name) @types[name.upcase] end |
.matches(type, matches) ⇒ boolean
146 147 148 149 150 151 152 153 154 155 |
# File 'lib/hackle/internal/model/target.rb', line 146 def self.matches(type, matches) case type when MATCH matches when NOT_MATCH !matches else raise ArgumentError, "Unsupported type: #{type}" end end |
.values ⇒ Array<TargetMatchType>
139 140 141 |
# File 'lib/hackle/internal/model/target.rb', line 139 def self.values @types.values end |
Instance Method Details
#to_s ⇒ Object
120 121 122 |
# File 'lib/hackle/internal/model/target.rb', line 120 def to_s name end |