Class: XRay::CSS::StyleSheet
Instance Attribute Summary collapse
-
#statements ⇒ Object
readonly
Returns the value of attribute statements.
Instance Method Summary collapse
- #directives ⇒ Object (also: #at_rules)
-
#initialize(statements) ⇒ StyleSheet
constructor
A new instance of StyleSheet.
- #position ⇒ Object
- #rulesets ⇒ Object
- #text ⇒ Object
Constructor Details
#initialize(statements) ⇒ StyleSheet
Returns a new instance of StyleSheet.
10 11 12 |
# File 'lib/css/struct.rb', line 10 def initialize(statements) @statements = statements end |
Instance Attribute Details
#statements ⇒ Object (readonly)
Returns the value of attribute statements.
8 9 10 |
# File 'lib/css/struct.rb', line 8 def statements @statements end |
Instance Method Details
#directives ⇒ Object Also known as: at_rules
22 23 24 |
# File 'lib/css/struct.rb', line 22 def directives statements.select { |elm| elm.is_a? Directive } end |
#position ⇒ Object
18 19 20 |
# File 'lib/css/struct.rb', line 18 def position rulesets.empty? ? nil : rulesets[0].position end |
#rulesets ⇒ Object
26 27 28 |
# File 'lib/css/struct.rb', line 26 def rulesets statements.select { |elm| elm.is_a? RuleSet } end |
#text ⇒ Object
14 15 16 |
# File 'lib/css/struct.rb', line 14 def text rulesets.collect(&:text).join("\n") end |