Class: XRay::CSS::RuleSet

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(selector, declarations) ⇒ RuleSet

Returns a new instance of RuleSet.



61
62
63
# File 'lib/css/struct.rb', line 61

def initialize(selector, declarations)
  @selector, @declarations = selector, declarations
end

Instance Attribute Details

#declarationsObject (readonly)

Returns the value of attribute declarations.



59
60
61
# File 'lib/css/struct.rb', line 59

def declarations
  @declarations
end

#selectorObject (readonly)

Returns the value of attribute selector.



59
60
61
# File 'lib/css/struct.rb', line 59

def selector
  @selector
end

Instance Method Details

#positionObject



73
74
75
# File 'lib/css/struct.rb', line 73

def position
  selector.position
end

#textObject



65
66
67
68
69
70
71
# File 'lib/css/struct.rb', line 65

def text
  decs_text = declarations.collect { |dec|
    "#{' ' * 4}#{dec};"
  }.join("\n")
  
  "#{selector} {\n#{decs_text}\n}"
end