Class: Fdlint::Parser::CSS::StyleSheet
- Defined in:
- lib/fdlint/parser/css/struct.rb
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.
9 10 11 |
# File 'lib/fdlint/parser/css/struct.rb', line 9 def initialize(statements) @statements = statements end |
Instance Attribute Details
#statements ⇒ Object (readonly)
Returns the value of attribute statements.
7 8 9 |
# File 'lib/fdlint/parser/css/struct.rb', line 7 def statements @statements end |
Instance Method Details
#directives ⇒ Object Also known as: at_rules
21 22 23 |
# File 'lib/fdlint/parser/css/struct.rb', line 21 def directives statements.select { |elm| elm.is_a? Directive } end |
#position ⇒ Object
17 18 19 |
# File 'lib/fdlint/parser/css/struct.rb', line 17 def position rulesets.empty? ? nil : rulesets[0].position end |
#rulesets ⇒ Object
25 26 27 |
# File 'lib/fdlint/parser/css/struct.rb', line 25 def rulesets statements.select { |elm| elm.is_a? RuleSet } end |
#text ⇒ Object
13 14 15 |
# File 'lib/fdlint/parser/css/struct.rb', line 13 def text rulesets.collect(&:text).join("\n") end |