Class: CssBuilder
- Inherits:
-
Object
show all
- Defined in:
- lib/css_builder.rb
Instance Method Summary
collapse
Constructor Details
Returns a new instance of CssBuilder.
3
4
5
|
# File 'lib/css_builder.rb', line 3
def initialize
@css = ''
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &block) ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/css_builder.rb', line 26
def method_missing(m, *args, &block)
if block
_start_tag(m, *args, &block)
else
_indent
css! _dasherize m
css! " : #{args.first};"
_newline
end
@css
end
|
Instance Method Details
#class!(*args, &block) ⇒ Object
21
22
23
24
|
# File 'lib/css_builder.rb', line 21
def class!(*args, &block)
_start_tag(_class(args[0]), *args[1..-1], &block)
@css
end
|
11
12
13
14
|
# File 'lib/css_builder.rb', line 11
def ()
@css << "/* #{comment} */"
_newline
end
|
#id!(*args, &block) ⇒ Object
16
17
18
19
|
# File 'lib/css_builder.rb', line 16
def id!(*args, &block)
_start_tag("##{args[0]}", *args[1..-1], &block)
@css
end
|
#value! ⇒ Object
7
8
9
|
# File 'lib/css_builder.rb', line 7
def value!
@css
end
|