Class: DryCss::CSS

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uri) ⇒ CSS

Returns a new instance of CSS.



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

def initialize(uri)
  @parser = DryCss::Parser.new
  @parser.load_uri!(uri)
end

Instance Attribute Details

#parserObject (readonly)

Returns the value of attribute parser.



3
4
5
# File 'lib/dry_css/css.rb', line 3

def parser
  @parser
end

Instance Method Details

#colorsObject



9
10
11
# File 'lib/dry_css/css.rb', line 9

def colors
  @colors ||= scan_for(CssParser::RE_COLOUR)
end

#sorted(scan) ⇒ Object



13
14
15
# File 'lib/dry_css/css.rb', line 13

def sorted(scan)
  scan.sort_by{|k,v| v }.reverse
end