Class: Algoheader::SvgGenerator
- Inherits:
-
ServiceObject
- Object
- ServiceObject
- Algoheader::SvgGenerator
- Defined in:
- lib/algoheader/svg_generator.rb
Overview
SvgGenerator
- Author
-
Dick Davis
- Copyright
-
Copyright 2021 Dick Davis
- License
-
GNU Public License 3
Generates SVGs by providing randomized input to algorithm.
Constant Summary collapse
- SYMBOLS =
['/', '|', '\\', '-', '+', 'x', 'o', "\#", '.'].freeze
- WIDTHS =
[0.75, 1.0, 1.5].freeze
- LINECAPS =
%w[butt round square].freeze
- OPACITIES =
[0.8, 0.9, 1.0].freeze
Instance Attribute Summary collapse
-
#fill_colors ⇒ Object
readonly
Returns the value of attribute fill_colors.
-
#stroke_colors ⇒ Object
readonly
Returns the value of attribute stroke_colors.
Instance Method Summary collapse
-
#call ⇒ Object
rubocop:enable Lint/MissingSuper.
-
#initialize(fill_colors:, stroke_colors:) ⇒ SvgGenerator
constructor
rubocop:disable Lint/MissingSuper.
Methods inherited from ServiceObject
Constructor Details
#initialize(fill_colors:, stroke_colors:) ⇒ SvgGenerator
rubocop:disable Lint/MissingSuper
40 41 42 43 |
# File 'lib/algoheader/svg_generator.rb', line 40 def initialize(fill_colors:, stroke_colors:) @fill_colors = fill_colors @stroke_colors = stroke_colors end |
Instance Attribute Details
#fill_colors ⇒ Object (readonly)
Returns the value of attribute fill_colors.
37 38 39 |
# File 'lib/algoheader/svg_generator.rb', line 37 def fill_colors @fill_colors end |
#stroke_colors ⇒ Object (readonly)
Returns the value of attribute stroke_colors.
37 38 39 |
# File 'lib/algoheader/svg_generator.rb', line 37 def stroke_colors @stroke_colors end |
Instance Method Details
#call ⇒ Object
rubocop:enable Lint/MissingSuper
46 47 48 49 50 51 |
# File 'lib/algoheader/svg_generator.rb', line 46 def call ascii = AsciiToSvg.example_string(random_symbol_sample, 80) AsciiToSvg.from_string(ascii, 16, **) rescue ZeroDivisionError retry end |