Class: Fdlint::Parser::CSS::Directive

Inherits:
Node
  • Object
show all
Defined in:
lib/fdlint/parser/css/struct.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(keyword, expression, block = nil) ⇒ Directive

Returns a new instance of Directive.



35
36
37
# File 'lib/fdlint/parser/css/struct.rb', line 35

def initialize(keyword, expression, block = nil)
  @keyword, @expression, @block = keyword, expression, block 
end

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block.



33
34
35
# File 'lib/fdlint/parser/css/struct.rb', line 33

def block
  @block
end

#expressionObject (readonly)

Returns the value of attribute expression.



33
34
35
# File 'lib/fdlint/parser/css/struct.rb', line 33

def expression
  @expression
end

#keywordObject (readonly)

Returns the value of attribute keyword.



33
34
35
# File 'lib/fdlint/parser/css/struct.rb', line 33

def keyword
  @keyword
end

Instance Method Details

#positionObject



52
53
54
# File 'lib/fdlint/parser/css/struct.rb', line 52

def position
  keyword.position
end

#textObject



39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/fdlint/parser/css/struct.rb', line 39

def text
  t = "@#{keyword}"
  if expression
    t += "#{expression}"
  end
  if block
    t += "{\n#{block}\n}\n"
  else
    t += ';'
  end
  t
end