Class: Gurke::Tag
- Inherits:
-
Object
- Object
- Gurke::Tag
- Defined in:
- lib/gurke/tag.rb
Instance Attribute Summary collapse
-
#file ⇒ String
readonly
Return path to file containing this feature.
-
#line ⇒ Fixnum
readonly
Return line number where this feature is defined.
- #raw ⇒ Object readonly private
Instance Method Summary collapse
-
#initialize(file, line, raw) ⇒ Tag
constructor
private
A new instance of Tag.
- #match?(rule) ⇒ Boolean
- #name ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(file, line, raw) ⇒ Tag
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Tag.
20 21 22 |
# File 'lib/gurke/tag.rb', line 20 def initialize(file, line, raw) @file, @line, @raw = file, line, raw end |
Instance Attribute Details
#file ⇒ String (readonly)
Return path to file containing this feature.
8 9 10 |
# File 'lib/gurke/tag.rb', line 8 def file @file end |
#line ⇒ Fixnum (readonly)
Return line number where this feature is defined.
14 15 16 |
# File 'lib/gurke/tag.rb', line 14 def line @line end |
#raw ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
17 18 19 |
# File 'lib/gurke/tag.rb', line 17 def raw @raw end |
Instance Method Details
#match?(rule) ⇒ Boolean
32 33 34 35 36 37 38 |
# File 'lib/gurke/tag.rb', line 32 def match?(rule) p rule p name negated = rule[0] == '~' name = negated ? rule[1..-1] : rule negated != (self.name == name) end |
#name ⇒ Object
24 25 26 |
# File 'lib/gurke/tag.rb', line 24 def name raw.name[1..-1] end |
#to_s ⇒ Object
28 29 30 |
# File 'lib/gurke/tag.rb', line 28 def to_s name end |