Class: CSSShapes::Example::ShapeSample
- Inherits:
-
Object
- Object
- CSSShapes::Example::ShapeSample
- Defined in:
- lib/css_shapes/example.rb
Instance Method Summary collapse
- #css ⇒ Object
- #dom_id ⇒ Object
-
#initialize(count, shape, args) ⇒ ShapeSample
constructor
A new instance of ShapeSample.
- #scss(on_dom_id = 'shape') ⇒ Object
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
#css ⇒ Object
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_id ⇒ Object
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 |