Module: CSS

Defined in:
lib/css.rb

Class Method Summary collapse

Class Method Details

.property(method, *args, &block) ⇒ Object

Write a css property declaration with the name of the called method

Parameters:

  • method (Symbol)

    the called method name as a symbol



17
18
19
# File 'lib/css.rb', line 17

def self.property method, *args, &block
  $stdout.write "#{method.to_s.gsub('_', '-')}:#{args[0]};"
end

.selector(selector, &block) ⇒ Object

Write a css selector declaration to $stdout

Parameters:

  • selector (String)

    the selector name or string



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

def self.selector selector, &block
  $stdout.write "#{selector}{"; yield; $stdout.write "}"
end

.style(&block) ⇒ Object

Send a message to the module_eval method of CSS module. It is just an Alias.

Parameters:

  • &block (Proc)

    the code block to be executed in the CSS context



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

def self.style &block
  send :module_eval, &block
end