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.



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

#fileString (readonly)

Return path to file containing this feature.

Returns:

  • (String)

    File path.



10
11
12
# File 'lib/gurke/tag.rb', line 10

def file
  @file
end

#lineFixnum (readonly)

Return line number where this feature is defined.

Returns:

  • (Fixnum)

    Line number.



16
17
18
# File 'lib/gurke/tag.rb', line 16

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.



19
20
21
# File 'lib/gurke/tag.rb', line 19

def raw
  @raw
end

Instance Method Details

#match?(rule) ⇒ Boolean

Returns:

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

#nameObject



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

def name
  raw.name[1..]
end

#to_sObject



32
33
34
# File 'lib/gurke/tag.rb', line 32

def to_s
  name
end