Module: CSS
- Defined in:
- lib/css.rb
Class Method Summary collapse
- .method_missing(name, *args, &block) ⇒ Object
- .property(method, *args, &block) ⇒ Object
- .selector(selector, &block) ⇒ Object
- .style(&block) ⇒ Object
Class Method Details
.method_missing(name, *args, &block) ⇒ Object
16 17 18 19 |
# File 'lib/css.rb', line 16 def self.method_missing name, *args, &block send(:selector, *args, &block) if args[0] and block send(:property, name, *args, &block) if args[0] and !block end |
.property(method, *args, &block) ⇒ Object
12 13 14 |
# File 'lib/css.rb', line 12 def self.property method, *args, &block $stdout.write "#{method.to_s.gsub('_', '-')}:#{args[0]};" end |
.selector(selector, &block) ⇒ Object
8 9 10 |
# File 'lib/css.rb', line 8 def self.selector selector, &block $stdout.write "#{selector}{"; yield; $stdout.write "}" end |
.style(&block) ⇒ Object
4 5 6 |
# File 'lib/css.rb', line 4 def self.style &block send :module_eval, &block end |