gradient 0.5.0 → 0.5.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
  SHA1:
3
- metadata.gz: 16b46fdf7f784862a6e05230f8717e4485c5794c
4
- data.tar.gz: c677d43ca0e4cb0a3df7e28811ec9a442b8b7dce
3
+ metadata.gz: 3e3373476c3ad7247a50eabbe0ff7e5b0f7a4e95
4
+ data.tar.gz: bdbab6d95271fca6f514291c7a2a604fa162c610
5
5
  SHA512:
6
- metadata.gz: 040beeb18b21d234a733d1790d37f8c0508255cc6f44dcaa5dfaad1a08445736a0ffb0b771beb633b349c808b69e71bb8535788d82b4ef8497c9eadfcd06fa5c
7
- data.tar.gz: a6b6060794a681c72d6609af073c0b2f2fde4ec9c247de2c6f65f07ac60bfcabbf449a6810d08257d28aaf6d1a7e52edb39bddaf71c8ce90d3525f92da0251dc
6
+ metadata.gz: 92855ce1a1b3087fed669c3614f6ff9f1c6be3a5a777ce765f454cdf99d6ed5dc925c8912e3b94f441a356b2695aee5e0c8e881bcf7e3859322547ee672c3846
7
+ data.tar.gz: b575421b8176eecc7d0e8d52a4426359f6fee8ac02d76a7e37b7542a462425146ad0afaf68dc3d2f2845f5320d8c2c42bd7642f53234f889ae79e86046e40759
@@ -10,7 +10,8 @@ module Gradient
10
10
  end
11
11
 
12
12
  def initialize(*points)
13
- @points = points.flatten.sort
13
+ # Sort points using a stable sort algorithm
14
+ @points = points.flatten.sort_by.with_index { |x, idx| [x, idx] }
14
15
  @locations = @points.map { |point| point.location }
15
16
  end
16
17
 
@@ -19,7 +20,7 @@ module Gradient
19
20
  end
20
21
 
21
22
  def range
22
- @range ||=
23
+ @range ||=
23
24
  begin
24
25
  ends = [:first, :last]
25
26
  .map { |method| points.send(method) }
@@ -51,7 +52,7 @@ module Gradient
51
52
  serialize
52
53
  end
53
54
 
54
- private
55
+ private
55
56
 
56
57
  def interpolate_points(point_left, point_right, location)
57
58
  points = [point_left, point_right]
@@ -68,7 +69,7 @@ module Gradient
68
69
  weight)
69
70
  end
70
71
  color = Color::RGB.from_fraction(r, g, b)
71
- opacity = interpolate_floats(point_left.opacity,
72
+ opacity = interpolate_floats(point_left.opacity,
72
73
  point_right.opacity,
73
74
  weight)
74
75
  Point.new(location, color, opacity)
@@ -1,3 +1,3 @@
1
1
  module Gradient
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gradient
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philip Vieira
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-01-03 00:00:00.000000000 Z
11
+ date: 2016-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: color