Class: SvgoOptions
- Inherits:
-
Object
- Object
- SvgoOptions
- Defined in:
- lib/svgo.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
- #floatPrecision ⇒ Object
- #floatPrecision=(floatPrecision) ⇒ Object
- #get_options(*args) ⇒ Object
-
#initialize {|@options| ... } ⇒ SvgoOptions
constructor
A new instance of SvgoOptions.
- #js2svg ⇒ Object
- #js2svg=(js2svg) ⇒ Object
- #multipass ⇒ Object
- #multipass=(multipass) ⇒ Object
- #plugins ⇒ Object
- #plugins=(plugins) ⇒ Object
- #runtime ⇒ Object
- #runtime=(runtime) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize {|@options| ... } ⇒ SvgoOptions
Returns a new instance of SvgoOptions.
46 47 48 49 50 51 52 53 |
# File 'lib/svgo.rb', line 46 def initialize @options = OpenStruct.new( js2svg: OpenStruct.new(pretty: false), plugins: PLUGINS_DEFAULT.map { | p | [ p, true ] }.to_h, multipass: false ) yield @options if block_given? end |
Instance Method Details
#[](key) ⇒ Object
100 101 102 |
# File 'lib/svgo.rb', line 100 def [](key) @options[key.to_sym] end |
#floatPrecision ⇒ Object
84 85 86 |
# File 'lib/svgo.rb', line 84 def floatPrecision @options.floatPrecision end |
#floatPrecision=(floatPrecision) ⇒ Object
88 89 90 |
# File 'lib/svgo.rb', line 88 def floatPrecision=(floatPrecision) @options.floatPrecision = floatPrecision end |
#get_options(*args) ⇒ Object
55 56 57 58 59 60 61 62 |
# File 'lib/svgo.rb', line 55 def (*args) = @options.to_h [:js2svg] = [:js2svg].to_h [:plugins] = [:plugins].map { | plugin, params | {plugin => params} } end |
#js2svg ⇒ Object
68 69 70 |
# File 'lib/svgo.rb', line 68 def js2svg @options.js2svg end |
#js2svg=(js2svg) ⇒ Object
72 73 74 |
# File 'lib/svgo.rb', line 72 def js2svg=(js2svg) @options.js2svg = js2svg end |
#multipass ⇒ Object
92 93 94 |
# File 'lib/svgo.rb', line 92 def multipass @options.multipass end |
#multipass=(multipass) ⇒ Object
96 97 98 |
# File 'lib/svgo.rb', line 96 def multipass=(multipass) @options.multipass = multipass end |
#plugins ⇒ Object
76 77 78 |
# File 'lib/svgo.rb', line 76 def plugins @options.plugins end |
#plugins=(plugins) ⇒ Object
80 81 82 |
# File 'lib/svgo.rb', line 80 def plugins=(plugins) @options.plugins = plugins end |
#runtime ⇒ Object
104 105 106 |
# File 'lib/svgo.rb', line 104 def runtime @options.runtime end |
#runtime=(runtime) ⇒ Object
108 109 110 |
# File 'lib/svgo.rb', line 108 def runtime=(runtime) @options.runtime = runtime end |
#to_s ⇒ Object
64 65 66 |
# File 'lib/svgo.rb', line 64 def to_s .to_json end |