Class: SilkLayout::CSS::ComputedStyle
- Inherits:
-
Object
- Object
- SilkLayout::CSS::ComputedStyle
- Defined in:
- lib/silk_layout/css/computed_style.rb
Instance Method Summary collapse
- #[](property) ⇒ Object
- #explicit_display? ⇒ Boolean
- #explicit_height? ⇒ Boolean
- #explicit_width? ⇒ Boolean
-
#initialize(rules, parent_style = nil) ⇒ ComputedStyle
constructor
A new instance of ComputedStyle.
- #width ⇒ Object
Constructor Details
#initialize(rules, parent_style = nil) ⇒ ComputedStyle
Returns a new instance of ComputedStyle.
6 7 8 9 10 11 12 13 14 |
# File 'lib/silk_layout/css/computed_style.rb', line 6 def initialize(rules, parent_style = nil) @values = {} @explicit_properties = {} apply_rules(rules) apply_inheritance(parent_style) apply_defaults end |
Instance Method Details
#[](property) ⇒ Object
16 17 18 |
# File 'lib/silk_layout/css/computed_style.rb', line 16 def [](property) @values[property] end |
#explicit_display? ⇒ Boolean
34 35 36 |
# File 'lib/silk_layout/css/computed_style.rb', line 34 def explicit_display? @explicit_properties.key?("display") end |
#explicit_height? ⇒ Boolean
29 30 31 32 |
# File 'lib/silk_layout/css/computed_style.rb', line 29 def explicit_height? value = @values["height"] value && value != "auto" end |
#explicit_width? ⇒ Boolean
24 25 26 27 |
# File 'lib/silk_layout/css/computed_style.rb', line 24 def explicit_width? value = @values["width"] value && value != "auto" end |
#width ⇒ Object
20 21 22 |
# File 'lib/silk_layout/css/computed_style.rb', line 20 def width @values["width"] end |