class UnderOs::Parser

Generic templates/stylesheets parsing engine

Public Class Methods

new() click to toggle source
# File lib/under_os/parser.rb, line 10
def initialize
  @css  = CSS.new
  @html = HTML.new
end
parse(*args) click to toggle source
# File lib/under_os/parser.rb, line 5
def self.parse(*args)
  @inst ||= new
  @inst.parse *args
end

Public Instance Methods

parse(filename) click to toggle source
# File lib/under_os/parser.rb, line 15
def parse(filename)
  filepath = NSBundle.mainBundle.pathForResource(filename, ofType:nil)
  content  = filepath ? UnderOs::File.read(filepath) : ''

  case filename.split('.').pop
  when 'css'  then @css.parse(content)
  when 'html' then @html.parse(content)
  end
end