Class: Victor::CSS

Inherits:
Object
  • Object
show all
Defined in:
lib/victor/css.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = nil) ⇒ CSS

Returns a new instance of CSS.



6
7
8
# File 'lib/victor/css.rb', line 6

def initialize(attributes = nil)
  @attributes = attributes || {}
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



4
5
6
# File 'lib/victor/css.rb', line 4

def attributes
  @attributes
end

Instance Method Details

#renderObject



14
15
16
17
# File 'lib/victor/css.rb', line 14

def render
  return '' if attributes.empty?
  %Q{<style type="text/css">\n<![CDATA[\n#{self}\n]]>\n</style>\n}
end

#to_sObject



10
11
12
# File 'lib/victor/css.rb', line 10

def to_s
  convert_hash attributes
end