Class: CSS::MarginProperty
Constant Summary
Constants included
from Orientation
Orientation::NESW
Instance Method Summary
collapse
#compact_orientation
Methods inherited from Property
#<<, #[], create, #empty?, #eql?, #get, #has_property?, #hash, #initialize, #inspect, #method_missing, #respond_to?, #to_s
Methods included from Normalize
#normalize_property_name
Constructor Details
This class inherits a constructor from CSS::Property
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class CSS::Property
Instance Method Details
11
12
13
14
15
16
17
|
# File 'lib/css/properties/margin_property.rb', line 11
def ==(val)
if val.is_a?(Property)
super
else
value == val
end
end
|
7
8
9
|
# File 'lib/css/properties/margin_property.rb', line 7
def name
'margin'
end
|
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/css/properties/margin_property.rb', line 29
def to_style
top = @properties['top']
right = @properties['right']
bottom = @properties['bottom']
left = @properties['left']
if top && right && bottom && left
value = compact_orientation(top, right, bottom, left)
[name, value].join(':')
else
default_properties.keys.map { |prop| @properties[prop] ? ["#{name}-#{prop}", @properties[prop].value].join(':') : nil }.compact.join(';')
end
end
|
19
20
21
22
23
24
25
26
27
|
# File 'lib/css/properties/margin_property.rb', line 19
def value
top = @properties['top']
right = @properties['right']
bottom = @properties['bottom']
left = @properties['left']
if top && right && bottom && left
compact_orientation(top, right, bottom, left)
end
end
|