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



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

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

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



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

def attributes
  @attributes
end

Instance Method Details

#renderObject



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

def render
  return '' if attributes.empty?

  %[<style>\n#{self}\n</style>\n]
end

#to_sObject



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

def to_s
  convert_hash attributes
end