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.
22 23 24 25 26 |
# File 'lib/gurke/tag.rb', line 22 def initialize(file, line, raw) @file = file @line = line @raw = raw end |
Instance Attribute Details
#file ⇒ String (readonly)
Return path to file containing this feature.
10 11 12 |
# File 'lib/gurke/tag.rb', line 10 def file @file end |
#line ⇒ Fixnum (readonly)
Return line number where this feature is defined.
16 17 18 |
# File 'lib/gurke/tag.rb', line 16 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.
19 20 21 |
# File 'lib/gurke/tag.rb', line 19 def raw @raw end |
Instance Method Details
#match?(rule) ⇒ Boolean
36 37 38 39 40 41 42 |
# File 'lib/gurke/tag.rb', line 36 def match?(rule) p rule p name negated = rule[0] == '~' name = negated ? rule[1..] : rule negated != (self.name == name) end |
#name ⇒ Object
28 29 30 |
# File 'lib/gurke/tag.rb', line 28 def name raw.name[1..] end |
#to_s ⇒ Object
32 33 34 |
# File 'lib/gurke/tag.rb', line 32 def to_s name end |