Class: Gurke::Tag

Inherits:
Object
  • Object
show all
Defined in:
lib/gurke/tag.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#fileString (readonly)

Return path to file containing this feature.

Returns:

  • (String)

    File path.



8
9
10
# File 'lib/gurke/tag.rb', line 8

def file
  @file
end

#lineFixnum (readonly)

Return line number where this feature is defined.

Returns:

  • (Fixnum)

    Line number.



14
15
16
# File 'lib/gurke/tag.rb', line 14

def line
  @line
end

#rawObject (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

Returns:

  • (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

#nameObject



24
25
26
# File 'lib/gurke/tag.rb', line 24

def name
  raw.name[1..-1]
end

#to_sObject



28
29
30
# File 'lib/gurke/tag.rb', line 28

def to_s
  name
end