Class: CSS::BorderProperty

Inherits:
Property show all
Defined in:
lib/css/properties/border_property.rb

Direct Known Subclasses

OutlineProperty

Instance Method Summary collapse

Methods inherited from Property

#<<, #==, #[], create, #get, #initialize, #inspect, #method_missing, #value

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

#nameObject



3
4
5
# File 'lib/css/properties/border_property.rb', line 3

def name
  'border'
end

#to_sObject



7
8
9
10
11
12
13
14
# File 'lib/css/properties/border_property.rb', line 7

def to_s
  value = %w(size style color).map { |prop| @properties[prop] && @properties[prop] != default_properties[prop] ? @properties[prop].value : nil }.compact.join(' ')
  if value == @properties['size'].value
    "#{@properties['size']}"
  else
    value
  end
end

#to_styleObject



16
17
18
19
20
21
22
23
# File 'lib/css/properties/border_property.rb', line 16

def to_style
  value = %w(size style color).map { |prop| @properties[prop] && @properties[prop] != default_properties[prop] ? @properties[prop].value : nil }.compact.join(' ')
  if value == @properties['size'].value
    "border-size:#{@properties['size']}"
  else
    [name, value].join(':')
  end
end