class CSS

Public Instance Methods

property(method, *args, &block) click to toggle source

Write a css property declaration with the name of the called method @param method [Symbol] the called method name as a symbol

# File lib/css.rb, line 17
def property method, *args, &block
  $stdout.write "#{method.to_s.gsub('_', '-')}:#{args[0]};"
end
selector(selector) { || ... } click to toggle source

Write a css selector declaration to $stdout @param selector [String] the selector name or string

# File lib/css.rb, line 11
def selector selector, &block
  $stdout.write "#{selector}{"; yield; $stdout.write "}"
end
style(&block) click to toggle source

Send a message to the instance_eval method of a CSS instace. It is just an Alias. @param &block [Proc] the code block to be executed in the CSS instance context

# File lib/css.rb, line 5
def style &block
  send :instance_eval, &block
end

Private Instance Methods

method_missing(name, *args, &block) click to toggle source
# File lib/css.rb, line 23
def method_missing name, *args, &block
  send(:selector, *args, &block) if block
  send(:property, name, *args, &block) if args[0] and !block
end