Class: GridGenerator::Svg::Style

Inherits:
Object
  • Object
show all
Defined in:
lib/grid_generator/svg/style.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fill:, stroke: '#404040', stroke_width: 1, opacity: 1) ⇒ Style

Returns a new instance of Style.



4
5
6
7
8
9
# File 'lib/grid_generator/svg/style.rb', line 4

def initialize(fill: , stroke: '#404040', stroke_width: 1, opacity: 1) 
  @fill = fill
  @stroke = stroke
  @stroke_width = stroke_width
  @opacity = opacity
end

Instance Attribute Details

#fillObject (readonly)

Returns the value of attribute fill.



11
12
13
# File 'lib/grid_generator/svg/style.rb', line 11

def fill
  @fill
end

#opacityObject (readonly)

Returns the value of attribute opacity.



11
12
13
# File 'lib/grid_generator/svg/style.rb', line 11

def opacity
  @opacity
end

#strokeObject (readonly)

Returns the value of attribute stroke.



11
12
13
# File 'lib/grid_generator/svg/style.rb', line 11

def stroke
  @stroke
end

#stroke_widthObject (readonly)

Returns the value of attribute stroke_width.



11
12
13
# File 'lib/grid_generator/svg/style.rb', line 11

def stroke_width
  @stroke_width
end

Instance Method Details

#to_sObject



13
14
15
# File 'lib/grid_generator/svg/style.rb', line 13

def to_s
  "fill:#{fill};stroke:#{stroke};stroke-width:#{stroke_width};opacity:#{opacity};"
end