Module: DocomoCss::EmbeddableStyle

Defined in:
lib/docomo_css/embeddable_style.rb

Instance Method Summary collapse

Instance Method Details

#embed_style(style, options = {}) ⇒ Object



5
6
7
8
9
10
# File 'lib/docomo_css/embeddable_style.rb', line 5

def embed_style(style, options = {})
  options = {:inject_unsupported_styles => true}.merge!(options)
  style = style.dup
  inject_unsupported_styles(style) if options[:inject_unsupported_styles]
  merge_style style
end

#merge_style(other_style) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/docomo_css/embeddable_style.rb', line 12

def merge_style(other_style)
  return if other_style.empty?
  if self['style'] == nil
    self['style'] = other_style.to_s
  else
    self['style'] += ";" unless self['style'] =~ /;\Z/
    self['style'] += other_style.to_s
  end
end