Module: CSSShapes::Source

Defined in:
lib/css_shapes/source.rb

Defined Under Namespace

Classes: Shape

Class Method Summary collapse

Class Method Details

.contentsObject



7
8
9
10
# File 'lib/css_shapes/source.rb', line 7

def self.contents
  @data ||= File.read(File.expand_path('../assets/_shapes.scss',
                                       CSSShapes.root))
end

.shapesObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/css_shapes/source.rb', line 12

def self.shapes
  return @shapes if @shapes
  sass = Sass::Engine.new(contents, :syntax => :scss)
  tree = sass.to_tree
  @shapes = []
  tree.children.each do |mixin_node|
    Shape.new(mixin_node.name).tap do |shape|
      mixin_node.args.each do |var, default|
        shape.add_param(var.name, default)
      end
      @shapes << shape
    end
  end
  @shapes
end