Module: Csscss::Parser::BorderSide::Transformer::Helpers

Included in:
Csscss::Parser::Border::Transformer, Csscss::Parser::BorderSide::Transformer
Defined in:
lib/csscss/parser/border_side.rb

Instance Method Summary collapse

Instance Method Details

#transform_bottom(context) ⇒ Object



60
# File 'lib/csscss/parser/border_side.rb', line 60

def transform_bottom(context); transform_side("bottom", context); end

#transform_left(context) ⇒ Object



61
# File 'lib/csscss/parser/border_side.rb', line 61

def transform_left(context);   transform_side("left", context);   end

#transform_right(context) ⇒ Object



59
# File 'lib/csscss/parser/border_side.rb', line 59

def transform_right(context);  transform_side("right", context);  end

#transform_side(side, context) ⇒ Object



63
64
65
66
67
68
69
70
71
72
73
# File 'lib/csscss/parser/border_side.rb', line 63

def transform_side(side, context)
  width = context[:width]
  style = context[:style]
  color = context[:color]

  [].tap do |declarations|
    declarations << Declaration.from_parser("border-#{side}-width", width) if width
    declarations << Declaration.from_parser("border-#{side}-style", style) if style
    declarations << Declaration.from_parser("border-#{side}-color", color) if color
  end
end

#transform_top(context) ⇒ Object



58
# File 'lib/csscss/parser/border_side.rb', line 58

def transform_top(context);    transform_side("top", context);    end