Class: CssParserMaster::Declaration
- Inherits:
-
Object
- Object
- CssParserMaster::Declaration
- Defined in:
- lib/css_parser_master/declaration.rb
Instance Attribute Summary collapse
-
#important ⇒ Object
Returns the value of attribute important.
-
#order ⇒ Object
Returns the value of attribute order.
-
#property ⇒ Object
Returns the value of attribute property.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #[](index) ⇒ Object
-
#initialize(property, value, important = false, order = 0) ⇒ Declaration
constructor
A new instance of Declaration.
- #to_text(importance = nil) ⇒ Object
Constructor Details
#initialize(property, value, important = false, order = 0) ⇒ Declaration
Returns a new instance of Declaration.
5 6 7 8 9 10 11 |
# File 'lib/css_parser_master/declaration.rb', line 5 def initialize(property, value, important = false, order = 0) # puts "init new declaration: #{property}" @property = property @value = value @important = important @order = order end |
Instance Attribute Details
#important ⇒ Object
Returns the value of attribute important.
3 4 5 |
# File 'lib/css_parser_master/declaration.rb', line 3 def important @important end |
#order ⇒ Object
Returns the value of attribute order.
3 4 5 |
# File 'lib/css_parser_master/declaration.rb', line 3 def order @order end |
#property ⇒ Object
Returns the value of attribute property.
3 4 5 |
# File 'lib/css_parser_master/declaration.rb', line 3 def property @property end |
#value ⇒ Object
Returns the value of attribute value.
3 4 5 |
# File 'lib/css_parser_master/declaration.rb', line 3 def value @value end |
Instance Method Details
#[](index) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/css_parser_master/declaration.rb', line 13 def [] index case index when :value value when :order order when :is_important important when :property property end end |
#to_text(importance = nil) ⇒ Object
26 27 28 |
# File 'lib/css_parser_master/declaration.rb', line 26 def to_text(importance = nil) "#{property}: #{value}#{ ' !important' if important || importance};" end |