Class: RubyCss::Stylesheet

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_css.rb

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ Stylesheet

Returns a new instance of Stylesheet.



91
92
93
94
# File 'lib/ruby_css.rb', line 91

def initialize(file)
  @__selectors = []
  instance_eval( File.read(file) )
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &blk) ⇒ Object



96
97
98
# File 'lib/ruby_css.rb', line 96

def method_missing(method_name, *args, &blk)
  @__selectors << Selector.new(method_name, &blk) if block_given?
end

Instance Method Details

#to_cssObject



100
101
102
103
104
105
# File 'lib/ruby_css.rb', line 100

def to_css
  puts "\n\n"
  @__selectors.each do |s|
    puts s.to_s
  end
end