Method: ChunkyCSS::MediaQuery#initialize
- Defined in:
- lib/chunky_css.rb
#initialize(querystr) ⇒ MediaQuery
Returns a new instance of MediaQuery.
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/chunky_css.rb', line 86 def initialize(querystr) @features = {} @type = "all" @css_rules = "" scanner = StringScanner.new(querystr) while !scanner.eos? do if scanner.scan RegEx::TYPE @type = scanner[1] elsif scanner.scan RegEx::FEATURE_WITH_LENGTH (key, value) = scanner[1].split(/\s*:\s*/) @features[key] = value.gsub(/\s/, '') else scanner.getch end end end |