Class: CSS::Parser
- Inherits:
-
Object
- Object
- CSS::Parser
- Defined in:
- lib/css/parser.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#parse(file_file_name_or_style_string) ⇒ Object
Parse a css style by string, file or file name.
Class Method Details
.parse(file_file_name_or_style_string) ⇒ Object
35 36 37 |
# File 'lib/css/parser.rb', line 35 def self.parse(file_file_name_or_style_string) new.parse(file_file_name_or_style_string) end |
Instance Method Details
#parse(file_file_name_or_style_string) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/css/parser.rb', line 14 def parse(file_file_name_or_style_string) css_style = file_file_name_or_style_string reset lineno = 1 if css_style.respond_to?(:size) && css_style.size < 255 && File.exists?(css_style) File.open(css_style) do |file| file.each_line do |line| parse_line(line, lineno) lineno += 1 end end elsif css_style.respond_to?(:each_line) css_style.each_line do |line| parse_line(line, lineno) lineno += 1 end end @ruleset end |