victor 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 570be7929b620bdcb3adcb37d2182a0ea0deee5d4f49c4c2838e514e76c2d2a4
4
- data.tar.gz: 65cd04f3e79dc21bd92f3f69b3ef0423a41a984dbb2587bb100ab670f0726a20
3
+ metadata.gz: ff2d91fe91857b10d35b9762dcbec3ee26ac3028c5522b7bdb33f73570a53422
4
+ data.tar.gz: b1fce99903fcf5cc4d1b024b48d8382046e4426c57bb7a621265abb3db187008
5
5
  SHA512:
6
- metadata.gz: b9a51385a22338882cc44206f701db4e967bc5791bc304a2293c7e4f039c270a4be6992150b77a85321da3ce062af62b23bf56ea57197786444f0a966b34c849
7
- data.tar.gz: 27e19905febac5c63bc7d7f28cc2f777c831d55cca3bfe1a069207c1cf477956f2cabd0e3e319bb6db853bc2433e669c90092dd61f31f3c5b7f79f58693cf541
6
+ metadata.gz: 25eac4f567fa4b492bc9bded59d2194f2ac4c89283f71b748db2c8ccc3245793cdea7535131058282dace0fd366aa15f4e676414c2a2c823ea37d9f7777b01e4
7
+ data.tar.gz: 694d7f6ff8b2264aec64d3d2955751b9b375a0e25cc4b1aa35c6328de97ee6ce6996ff8744bc86bb5b50cb9ed712644c25431f2a7213b68a8ba05e5b1fdb9802
data/README.md CHANGED
@@ -224,6 +224,23 @@ svg << other
224
224
  svg.append other
225
225
  ```
226
226
 
227
+ To make this common use case a little easier to use, you can use a block when instantiating a new `SVG` object:
228
+
229
+ ```ruby
230
+ troll = SVG.new do
231
+ circle cx: 50, cy: 60, r: 24, fill: 'yellow'
232
+ end
233
+ ```
234
+
235
+ Which is the same as:
236
+
237
+ ```ruby
238
+ troll = SVG.new
239
+ troll.build do
240
+ circle cx: 50, cy: 60, r: 24, fill: 'yellow'
241
+ end
242
+ ```
243
+
227
244
  Another approach to a more modular SVG composition, would be to subclass
228
245
  `Victor::SVG`.
229
246
 
@@ -378,7 +395,7 @@ See the [xml encoding example](https://github.com/DannyBen/victor/tree/master/ex
378
395
 
379
396
  ### DSL Syntax
380
397
 
381
- Victor supports another a cleaner DSL-like syntax. To use it, simply `require 'victor/script'`.
398
+ Victor also supports a DSL-like syntax. To use it, simply `require 'victor/script'`.
382
399
 
383
400
  Once required, you have access to:
384
401
 
@@ -409,15 +426,16 @@ See the [example_rails](example_rails) folder.
409
426
 
410
427
  ## Related Projects
411
428
 
412
- ### [victor-cli]
429
+ ### [Victor CLI][victor-cli]
413
430
 
414
- A command line utility that generates Victor Ruby code from SVG code.
431
+ A command line utility that allows converting Ruby to SVG as well as SVG to
432
+ Victor Ruby scripts.
415
433
 
416
- ### [victor-opal]
434
+ ### [Victor Opal][victor-opal]
417
435
 
418
436
  A Victor playground that works in the browser.
419
437
 
420
- ### [Icodi]
438
+ ### [Icodi][icodi]
421
439
 
422
440
  A Ruby gem that uses Victor to generate consistent random icon
423
441
  images, similar to GitHub's identicon.
@@ -4,10 +4,11 @@ module Victor
4
4
  attr_accessor :template, :css
5
5
  attr_reader :content, :svg_attributes
6
6
 
7
- def initialize(attributes = nil)
7
+ def initialize(attributes = nil, &block)
8
8
  setup attributes
9
9
  @content = []
10
10
  @css = {}
11
+ build &block if block_given?
11
12
  end
12
13
 
13
14
  def <<(additional_content)
@@ -1,3 +1,3 @@
1
1
  module Victor
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
data/lib/victor.rb CHANGED
@@ -4,3 +4,5 @@ require 'victor/svg'
4
4
  require 'victor/attributes'
5
5
  require 'victor/css'
6
6
  require 'victor/dsl'
7
+
8
+ require 'byebug' if ENV['BYEBUG']
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: victor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danny Ben Shitrit
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-29 00:00:00.000000000 Z
11
+ date: 2020-05-05 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Build SVG images with ease
14
14
  email: db@dannyben.com