Class: MinispecMetadata::Tag
- Inherits:
-
Object
- Object
- MinispecMetadata::Tag
- Defined in:
- lib/minispec-metadata/tags.rb
Instance Method Summary collapse
- #exclusive? ⇒ Boolean
- #inclusive? ⇒ Boolean
-
#initialize(tag_string) ⇒ Tag
constructor
A new instance of Tag.
- #key ⇒ Object
- #value ⇒ Object
- #value? ⇒ Boolean
Constructor Details
#initialize(tag_string) ⇒ Tag
Returns a new instance of Tag.
63 64 65 |
# File 'lib/minispec-metadata/tags.rb', line 63 def initialize(tag_string) @tag_string = tag_string end |
Instance Method Details
#exclusive? ⇒ Boolean
67 68 69 |
# File 'lib/minispec-metadata/tags.rb', line 67 def exclusive? @tag_string.start_with? '~' end |
#inclusive? ⇒ Boolean
71 72 73 |
# File 'lib/minispec-metadata/tags.rb', line 71 def inclusive? !exclusive? end |
#key ⇒ Object
75 76 77 |
# File 'lib/minispec-metadata/tags.rb', line 75 def key @key ||= @tag_string[/\w+/] end |
#value ⇒ Object
79 80 81 |
# File 'lib/minispec-metadata/tags.rb', line 79 def value @value ||= @tag_string.split(':').last if value? end |
#value? ⇒ Boolean
83 84 85 |
# File 'lib/minispec-metadata/tags.rb', line 83 def value? !!@tag_string[/:/] end |