gradient 0.2.1 → 0.2.2

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
  SHA1:
3
- metadata.gz: d1f221b462b155e39221e11c072bc4fa239ac6cd
4
- data.tar.gz: 6144d6cefe6597a3c647e41b1a82d3024d632b78
3
+ metadata.gz: c90b95d6eda4af13387ef56d48ee13c135ae97dd
4
+ data.tar.gz: ce7e64d799a4587190a79d3934f023aa4c8908c5
5
5
  SHA512:
6
- metadata.gz: 1458c99a8451d8565749f8cc0bc15b0f150c17eb6a7086fdb7d244a445881da380e47e02bbb55af2c2aff3153576cd19e7139b965e6c8fee9b42504c3c770b79
7
- data.tar.gz: 9200849839136d6baa4ade7919f31f272a421133dd0833cddfd9d79a4b29e3175d965a200f133bd5fba377f8921dbb2d667802d0660ecaabcc05720060b30a57
6
+ metadata.gz: 8169e8ba9be408feb1007d7bbfc0f7627613f3632091df5635b1aa126036813c28c35a26d764c1304315579dbc45bd8c4e579a814b6bcac390498fa7b5642cbc
7
+ data.tar.gz: ebc81c832dc63be8435c7fad298e1f1ad41f467c762e25e86ae9be57686681f2dbb01024c8a34c9f1dde880a35b9124080aaee0ae0e058898b98961d04c4cfba
data/lib/gradient/map.rb CHANGED
@@ -4,6 +4,8 @@ module Gradient
4
4
  attr_reader :color_points, :opacity_points, :points
5
5
 
6
6
  def initialize(color_points=[], opacity_points=[])
7
+ color_points << Gradient::ColorPoint.new(0, Color::RGB.new(255, 255, 255)) if color_points.empty?
8
+ opacity_points << Gradient::OpacityPoint.new(0, 1) if opacity_points.empty?
7
9
  @color_points = sort_points(Array(color_points))
8
10
  @opacity_points = sort_points(Array(opacity_points))
9
11
  @all_points = sort_points(@color_points + @opacity_points)
@@ -44,8 +46,8 @@ module Gradient
44
46
 
45
47
  private def previous_and_next_in(bucket, point)
46
48
  groups = bucket.group_by { |p| point_group(p, point) }
47
- a = groups.fetch(:same) { groups.fetch(:less) }.max { |p| p.location }
48
- b = groups.fetch(:same) { groups.fetch(:more) }.min { |p| p.location }
49
+ a = groups.fetch(:same) { groups.fetch(:less) { groups.fetch(:more) } }.max { |p| p.location }
50
+ b = groups.fetch(:same) { groups.fetch(:more) { groups.fetch(:less) } }.min { |p| p.location }
49
51
  return a, b
50
52
  end
51
53
 
@@ -1,3 +1,3 @@
1
1
  module Gradient
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gradient
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philip Vieira