Class: CSSShapes::Example::ShapeSample

Inherits:
Object
  • Object
show all
Defined in:
lib/css_shapes/example.rb

Instance Method Summary collapse

Constructor Details

#initialize(count, shape, args) ⇒ ShapeSample

Returns a new instance of ShapeSample.



65
66
67
68
69
# File 'lib/css_shapes/example.rb', line 65

def initialize(count, shape, args)
  @count = count
  @shape = shape
  @args = args
end

Instance Method Details

#cssObject



71
72
73
# File 'lib/css_shapes/example.rb', line 71

def css
  Sass.compile(Source.contents + "\n" + scss(dom_id), :syntax => :scss)
end

#dom_idObject



81
82
83
# File 'lib/css_shapes/example.rb', line 81

def dom_id
  "shape_sample_#{@shape.name}_#{@count}"
end

#scss(on_dom_id = 'shape') ⇒ Object



75
76
77
78
79
# File 'lib/css_shapes/example.rb', line 75

def scss(on_dom_id = 'shape')
  ["##{on_dom_id} {",
   "  @include #{@shape.name}(#{@args.join(', ')});",
   "}"].join("\n")
end