bicycle 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0a855482019bd1a65dfecf2155ac086fb36a0ac7
4
- data.tar.gz: 14bb2c934998b847c015d74250138645d8fb4305
3
+ metadata.gz: 631d1e80fe359b6d80d4b64264de0372f1544ab0
4
+ data.tar.gz: 6f60649c7788282ec14d9389f6af08cb382a9d26
5
5
  SHA512:
6
- metadata.gz: 9d92e3e2151817516b668528b6fe3e5f6aa36242355a44239b4bb9ffc352f4d5584fd53344eef5d96f446791b5a0866b2c1ab6c5a6282817272873d9ab639e67
7
- data.tar.gz: 1868630ff988409c1c3efab4e3e39b36961127d3d6aacabec4e2ff713d3fd549e4f96a2002c33f2adee938e16fd6abc84c91802c48076dcf628ff2bae01d899e
6
+ metadata.gz: e8ad62188f06498b4e3e9c4c328803ef8ea88efb269fbcac3fec8bc703ca164ae97ea2c0d39d33c9296e7582c9fa3502120317eef0be2c49e34c0b71240f64bb
7
+ data.tar.gz: 0d477808fabe2fc9ebe54e91375ea5fec2f0fa8b1d4bfb8c34fba9328bc092596870303f9219a47f7cefe2c496252f0804c27c7deb32ed4662cd0c52d638cd0a
data/.rubocop.yml ADDED
@@ -0,0 +1,25 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.4
3
+
4
+ # Use double quotes ALL THE TIME!!!
5
+ Style/StringLiterals:
6
+ EnforcedStyle: double_quotes
7
+
8
+ # Disable Style/Documentation because...
9
+ Style/Documentation:
10
+ Enabled: false
11
+
12
+ # Increase line length to 120
13
+ Metrics/LineLength:
14
+ Max: 120
15
+
16
+ # Exclude class and method length for test
17
+ Metrics/BlockLength:
18
+ Exclude:
19
+ - "test/**/*"
20
+ Metrics/ClassLength:
21
+ Exclude:
22
+ - "test/**/*"
23
+ Metrics/MethodLength:
24
+ Exclude:
25
+ - "test/**/*"
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ bicycle
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.4.2
data/.travis.yml ADDED
@@ -0,0 +1 @@
1
+ language: ruby
data/Gemfile CHANGED
@@ -1,14 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source "http://rubygems.org"
2
- # Add dependencies required to use your gem here.
3
- # Example:
4
- # gem "activesupport", ">= 2.3.5"
5
4
 
6
- # Add dependencies to develop your gem here.
7
- # Include everything needed to run rake, tests, features, etc.
8
5
  group :development do
9
6
  gem "bundler"
10
7
  gem "jeweler"
11
8
  gem "minitest"
12
9
  gem "turn"
13
10
  gem "yard"
14
- end
11
+ end
data/Gemfile.lock CHANGED
@@ -1,8 +1,7 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- addressable (2.5.1)
5
- public_suffix (~> 2.0, >= 2.0.2)
4
+ addressable (2.4.0)
6
5
  ansi (1.5.0)
7
6
  builder (3.2.3)
8
7
  descendants_tracker (0.0.4)
@@ -10,52 +9,51 @@ GEM
10
9
  faraday (0.9.2)
11
10
  multipart-post (>= 1.2, < 3)
12
11
  git (1.3.0)
13
- github_api (0.11.3)
14
- addressable (~> 2.3)
15
- descendants_tracker (~> 0.0.1)
12
+ github_api (0.16.0)
13
+ addressable (~> 2.4.0)
14
+ descendants_tracker (~> 0.0.4)
16
15
  faraday (~> 0.8, < 0.10)
17
- hashie (>= 1.2)
18
- multi_json (>= 1.7.5, < 2.0)
19
- nokogiri (~> 1.6.0)
20
- oauth2
21
- hashie (3.5.5)
22
- highline (1.7.8)
23
- jeweler (2.3.3)
16
+ hashie (>= 3.4)
17
+ mime-types (>= 1.16, < 3.0)
18
+ oauth2 (~> 1.0)
19
+ hashie (3.5.7)
20
+ highline (1.7.10)
21
+ jeweler (2.3.9)
24
22
  builder
25
- bundler (>= 1.0)
23
+ bundler
26
24
  git (>= 1.2.5)
27
- github_api (~> 0.11.0)
25
+ github_api (~> 0.16.0)
28
26
  highline (>= 1.6.15)
29
27
  nokogiri (>= 1.5.10)
30
- psych (~> 2.2)
28
+ psych
31
29
  rake
32
30
  rdoc
33
31
  semver2
34
32
  jwt (1.5.6)
35
- mini_portile2 (2.1.0)
33
+ mime-types (2.99.3)
34
+ mini_portile2 (2.3.0)
36
35
  minitest (4.7.5)
37
- multi_json (1.12.1)
36
+ multi_json (1.13.1)
38
37
  multi_xml (0.6.0)
39
38
  multipart-post (2.0.0)
40
- nokogiri (1.6.8.1)
41
- mini_portile2 (~> 2.1.0)
42
- oauth2 (1.3.1)
43
- faraday (>= 0.8, < 0.12)
39
+ nokogiri (1.8.2)
40
+ mini_portile2 (~> 2.3.0)
41
+ oauth2 (1.4.0)
42
+ faraday (>= 0.8, < 0.13)
44
43
  jwt (~> 1.0)
45
44
  multi_json (~> 1.3)
46
45
  multi_xml (~> 0.5)
47
46
  rack (>= 1.2, < 3)
48
- psych (2.2.4)
49
- public_suffix (2.0.5)
50
- rack (2.0.1)
51
- rake (12.0.0)
52
- rdoc (5.1.0)
47
+ psych (3.0.2)
48
+ rack (2.0.4)
49
+ rake (12.3.1)
50
+ rdoc (6.0.3)
53
51
  semver2 (3.4.2)
54
52
  thread_safe (0.3.6)
55
53
  turn (0.9.7)
56
54
  ansi
57
55
  minitest (~> 4)
58
- yard (0.9.8)
56
+ yard (0.9.12)
59
57
 
60
58
  PLATFORMS
61
59
  ruby
@@ -68,4 +66,4 @@ DEPENDENCIES
68
66
  yard
69
67
 
70
68
  BUNDLED WITH
71
- 1.14.6
69
+ 1.16.1
data/Rakefile CHANGED
@@ -1,38 +1,38 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
- require 'rubygems'
4
- require 'bundler'
3
+ require "rubygems"
4
+ require "bundler"
5
5
  begin
6
6
  Bundler.setup(:default, :development)
7
7
  rescue Bundler::BundlerError => e
8
- $stderr.puts e.message
9
- $stderr.puts "Run `bundle install` to install missing gems"
8
+ warn e.message
9
+ warn "Run `bundle install` to install missing gems"
10
10
  exit e.status_code
11
11
  end
12
- require 'rake'
12
+ require "rake"
13
13
 
14
- require 'jeweler'
14
+ require "jeweler"
15
15
  Jeweler::Tasks.new do |gem|
16
16
  # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
17
  gem.name = "bicycle"
18
18
  gem.homepage = "http://github.com/sleepingstu/bicycle"
19
19
  gem.license = "MIT"
20
- gem.summary = %Q{Why walk when you can cycle}
21
- gem.description = %Q{A convenience gem for cycling through a set of values, ported from the 'cycle' functionality found in Rails. It is independent of which framework you use so will run in Sinatra, Padrino or straight up Ruby itself.}
20
+ gem.summary = %(Why walk when you can cycle)
21
+ gem.description = %(A convenience gem for cycling through a set of values, ported from the 'cycle' functionality found in Rails. It is independent of which framework you use so will run in Sinatra, Padrino or straight up Ruby itself.)
22
22
  gem.email = "stuart.chinery@headlondon.com"
23
23
  gem.authors = ["Stuart Chinery", "Dave Hrycyszyn"]
24
24
  # dependencies defined in Gemfile
25
25
  end
26
26
  Jeweler::RubygemsDotOrgTasks.new
27
27
 
28
- require 'rake/testtask'
28
+ require "rake/testtask"
29
29
  Rake::TestTask.new(:test) do |test|
30
- test.libs << 'lib' << 'test'
31
- test.pattern = 'test/**/test_*.rb'
30
+ test.libs << "lib" << "test"
31
+ test.pattern = "test/**/test_*.rb"
32
32
  test.verbose = true
33
33
  end
34
34
 
35
- task :default => :test
35
+ task default: :test
36
36
 
37
- require 'yard'
38
- YARD::Rake::YardocTask.new
37
+ require "yard"
38
+ YARD::Rake::YardocTask.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.1
1
+ 0.4.0
data/bicycle.gemspec CHANGED
@@ -2,23 +2,28 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
-
5
+ # stub: bicycle 0.4.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
- s.name = "bicycle"
9
- s.version = File.read("VERSION").split("\n").first
8
+ s.name = "bicycle".freeze
9
+ s.version = "0.4.0"
10
10
 
11
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
- s.authors = ["Stuart Chinery", "Dave Hrycyszyn"]
13
- s.date = "2012-06-06"
14
- s.description = "A convenience gem for cycling through a set of values, ported from the 'cycle' functionality found in Rails. It is independent of which framework you use so will run in Sinatra, Padrino or straight up Ruby itself."
15
- s.email = "stuart.chinery@headlondon.com"
11
+ s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib".freeze]
13
+ s.authors = ["Stuart Chinery".freeze, "Dave Hrycyszyn".freeze]
14
+ s.date = "2018-04-04"
15
+ s.description = "A convenience gem for cycling through a set of values, ported from the 'cycle' functionality found in Rails. It is independent of which framework you use so will run in Sinatra, Padrino or straight up Ruby itself.".freeze
16
+ s.email = "stuart.chinery@headlondon.com".freeze
16
17
  s.extra_rdoc_files = [
17
18
  "LICENSE.txt",
18
19
  "README.md"
19
20
  ]
20
21
  s.files = [
21
22
  ".document",
23
+ ".rubocop.yml",
24
+ ".ruby-gemset",
25
+ ".ruby-version",
26
+ ".travis.yml",
22
27
  "Gemfile",
23
28
  "Gemfile.lock",
24
29
  "LICENSE.txt",
@@ -27,34 +32,37 @@ Gem::Specification.new do |s|
27
32
  "VERSION",
28
33
  "bicycle.gemspec",
29
34
  "lib/bicycle.rb",
35
+ "lib/bicycle/methods.rb",
30
36
  "test/helper.rb",
31
37
  "test/test_bicycle.rb"
32
38
  ]
33
- s.homepage = "http://github.com/sleepingstu/bicycle"
34
- s.licenses = ["MIT"]
35
- s.require_paths = ["lib"]
36
- s.rubygems_version = "1.8.19"
37
- s.summary = "Why walk when you can cycle"
39
+ s.homepage = "http://github.com/sleepingstu/bicycle".freeze
40
+ s.licenses = ["MIT".freeze]
41
+ s.rubygems_version = "2.6.13".freeze
42
+ s.summary = "Why walk when you can cycle".freeze
38
43
 
39
44
  if s.respond_to? :specification_version then
40
- s.specification_version = 3
45
+ s.specification_version = 4
41
46
 
42
47
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
43
- s.add_development_dependency(%q<minitest>, ["~> 0"])
44
- s.add_development_dependency(%q<yard>, ["~> 0.6"])
45
- s.add_development_dependency(%q<bundler>, ["~> 0"])
46
- s.add_development_dependency(%q<jeweler>, ["~> 1.6"])
48
+ s.add_development_dependency(%q<bundler>.freeze, [">= 0"])
49
+ s.add_development_dependency(%q<jeweler>.freeze, [">= 0"])
50
+ s.add_development_dependency(%q<minitest>.freeze, [">= 0"])
51
+ s.add_development_dependency(%q<turn>.freeze, [">= 0"])
52
+ s.add_development_dependency(%q<yard>.freeze, [">= 0"])
47
53
  else
48
- s.add_dependency(%q<minitest>, ["~> 0"])
49
- s.add_dependency(%q<yard>, ["~> 0.6"])
50
- s.add_dependency(%q<bundler>, ["~> 0"])
51
- s.add_dependency(%q<jeweler>, ["~> 1.6"])
54
+ s.add_dependency(%q<bundler>.freeze, [">= 0"])
55
+ s.add_dependency(%q<jeweler>.freeze, [">= 0"])
56
+ s.add_dependency(%q<minitest>.freeze, [">= 0"])
57
+ s.add_dependency(%q<turn>.freeze, [">= 0"])
58
+ s.add_dependency(%q<yard>.freeze, [">= 0"])
52
59
  end
53
60
  else
54
- s.add_dependency(%q<minitest>, ["~> 0"])
55
- s.add_dependency(%q<yard>, ["~> 0.6"])
56
- s.add_dependency(%q<bundler>, ["~> 0"])
57
- s.add_dependency(%q<jeweler>, ["~> 1.6"])
61
+ s.add_dependency(%q<bundler>.freeze, [">= 0"])
62
+ s.add_dependency(%q<jeweler>.freeze, [">= 0"])
63
+ s.add_dependency(%q<minitest>.freeze, [">= 0"])
64
+ s.add_dependency(%q<turn>.freeze, [">= 0"])
65
+ s.add_dependency(%q<yard>.freeze, [">= 0"])
58
66
  end
59
67
  end
60
68
 
data/lib/bicycle.rb CHANGED
@@ -1,7 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "bicycle/methods"
2
4
 
3
5
  module Bicycle
4
-
5
6
  include Bicycle::Methods
6
-
7
- end
7
+ end
@@ -0,0 +1,96 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bicycle
4
+ module Methods
5
+ # Creates a Cycle object whose _to_s_ method cycles through elements of an
6
+ # array every time it is called. This can be used for example, to alternate
7
+ # classes for table rows. You can use named cycles to allow nesting in loops.
8
+ # Passing a Hash as the last parameter with a <tt>:name</tt> key will create a
9
+ # named cycle. The default name for a cycle without a +:name+ key is
10
+ # <tt>"default"</tt>. You can manually reset a cycle by calling reset_cycle
11
+ # and passing the name of the cycle. The current cycle string can be obtained
12
+ # anytime using the current_cycle method.
13
+ #
14
+ def cycle(*values)
15
+ if values.last.instance_of? Hash
16
+ params = values.pop
17
+ name = params[:name]
18
+ else
19
+ name = "default"
20
+ end
21
+
22
+ cycle = get_cycle(name)
23
+ cycle = set_cycle(name, Cycle.new(values)) unless cycle && cycle.values == values
24
+ cycle.to_s
25
+ end
26
+
27
+ # Returns the current cycle string after a cycle has been started. Useful
28
+ # for complex table highlighting or any other design need which requires
29
+ # the current cycle string in more than one place.
30
+ #
31
+ def current_cycle(name = "default")
32
+ cycle = get_cycle(name)
33
+ cycle&.current_value
34
+ end
35
+
36
+ # Resets a cycle so that it starts from the first element the next time
37
+ # it is called. Pass in +name+ to reset a named cycle.
38
+ #
39
+ def reset_cycle(name = "default")
40
+ cycle = get_cycle(name)
41
+ cycle&.reset
42
+ end
43
+
44
+ class Cycle #:nodoc:
45
+ attr_reader :values
46
+
47
+ def initialize(values)
48
+ @values = values
49
+ reset
50
+ end
51
+
52
+ def reset
53
+ @index = 0
54
+ end
55
+
56
+ def current_value
57
+ @values[previous_index].to_s
58
+ end
59
+
60
+ def to_s
61
+ value = @values[@index].to_s
62
+ @index = next_index
63
+ value
64
+ end
65
+
66
+ private
67
+
68
+ def next_index
69
+ step_index(1)
70
+ end
71
+
72
+ def previous_index
73
+ step_index(-1)
74
+ end
75
+
76
+ def step_index(num)
77
+ (@index + num) % @values.size
78
+ end
79
+ end
80
+
81
+ private
82
+
83
+ # The cycle helpers need to store the cycles in a place that is
84
+ # guaranteed to be reset every time a page is rendered, so it
85
+ # uses an instance variable of ActionView::Base.
86
+ def get_cycle(name)
87
+ @_cycles = {} unless defined?(@_cycles)
88
+ @_cycles[name]
89
+ end
90
+
91
+ def set_cycle(name, cycle_object)
92
+ @_cycles = {} unless defined?(@_cycles)
93
+ @_cycles[name] = cycle_object
94
+ end
95
+ end
96
+ end
data/test/helper.rb CHANGED
@@ -1,22 +1,22 @@
1
- require 'rubygems'
2
- require 'bundler'
1
+ # frozen_string_literal: true
2
+
3
+ require "rubygems"
4
+ require "bundler"
3
5
  begin
4
6
  Bundler.setup(:default, :development)
5
7
  rescue Bundler::BundlerError => e
6
- $stderr.puts e.message
7
- $stderr.puts "Run `bundle install` to install missing gems"
8
+ warn e.message
9
+ warn "Run `bundle install` to install missing gems"
8
10
  exit e.status_code
9
11
  end
10
12
 
11
- require 'minitest/autorun'
13
+ require "minitest/autorun"
12
14
 
13
15
  $LOAD_PATH.unshift(File.dirname(__FILE__))
14
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
15
- require 'bicycle'
16
- begin; require 'turn/autorun'; rescue LoadError; end
17
-
16
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
17
+ require "bicycle"
18
+ begin; require "turn/autorun"; rescue LoadError; end
18
19
  class MiniTest::Unit::TestCase
19
-
20
20
  end
21
21
 
22
- MiniTest::Unit.autorun
22
+ MiniTest::Unit.autorun
data/test/test_bicycle.rb CHANGED
@@ -1,107 +1,109 @@
1
- require 'helper'
1
+ # frozen_string_literal: true
2
+
3
+ require "helper"
2
4
  include Bicycle
3
5
 
4
6
  describe "When cycling" do
5
- describe "with values" do
6
- before do
7
- @values = []
8
- for i in (0..3)
9
- @values[i] = cycle("Foo", "Bar", "Huh?")
10
- end
11
- end
7
+ describe "with values" do
8
+ before do
9
+ @values = []
10
+ (0..3).each do |i|
11
+ @values[i] = cycle("Foo", "Bar", "Huh?")
12
+ end
13
+ end
12
14
 
13
- it "should return a value in the cycle order" do
14
- assert_equal "Foo", @values[0]
15
- assert_equal "Bar", @values[1]
16
- assert_equal "Huh?", @values[2]
17
- assert_equal "Foo", @values[3]
18
- end
15
+ it "should return a value in the cycle order" do
16
+ assert_equal "Foo", @values[0]
17
+ assert_equal "Bar", @values[1]
18
+ assert_equal "Huh?", @values[2]
19
+ assert_equal "Foo", @values[3]
20
+ end
19
21
 
20
- describe "and with new values" do
21
- before do
22
- @values = []
23
- for i in (0..5)
24
- @values[i] = cycle("I", "just", "want", "to", "ride", :name => "bikes")
25
- end
26
- end
22
+ describe "and with new values" do
23
+ before do
24
+ @values = []
25
+ (0..5).each do |i|
26
+ @values[i] = cycle("I", "just", "want", "to", "ride", name: "bikes")
27
+ end
28
+ end
27
29
 
28
- it "should return a new value in the cycle order" do
29
- assert_equal "I", @values[0]
30
- assert_equal "just", @values[1]
31
- assert_equal "want", @values[2]
32
- assert_equal "to", @values[3]
33
- assert_equal "ride", @values[4]
34
- assert_equal "I", @values[0]
35
- end
36
- end
37
- end
30
+ it "should return a new value in the cycle order" do
31
+ assert_equal "I", @values[0]
32
+ assert_equal "just", @values[1]
33
+ assert_equal "want", @values[2]
34
+ assert_equal "to", @values[3]
35
+ assert_equal "ride", @values[4]
36
+ assert_equal "I", @values[0]
37
+ end
38
+ end
39
+ end
38
40
 
39
- describe "with multiple instances in one loop" do
40
- before do
41
- @values = []
42
- @sub_values = []
43
- for i in (0..3)
44
- @values[i] = cycle("Foo", "Bar", "Huh?")
41
+ describe "with multiple instances in one loop" do
42
+ before do
43
+ @values = []
44
+ @sub_values = []
45
+ (0..3).each do |i|
46
+ @values[i] = cycle("Foo", "Bar", "Huh?")
45
47
 
46
- value = []
47
- for j in (0..5)
48
- value[j] = cycle("I", "just", "want", "to", "ride", :name => "bikes")
49
- end
50
- @sub_values[i] = value
48
+ value = []
49
+ (0..5).each do |j|
50
+ value[j] = cycle("I", "just", "want", "to", "ride", name: "bikes")
51
+ end
52
+ @sub_values[i] = value
51
53
 
52
- reset_cycle("bikes")
53
- end
54
- end
54
+ reset_cycle("bikes")
55
+ end
56
+ end
55
57
 
56
- it "should return a value from the first cycle order" do
57
- assert_equal "Foo", @values[0]
58
- assert_equal "Bar", @values[1]
59
- assert_equal "Huh?", @values[2]
60
- assert_equal "Foo", @values[3]
61
- end
58
+ it "should return a value from the first cycle order" do
59
+ assert_equal "Foo", @values[0]
60
+ assert_equal "Bar", @values[1]
61
+ assert_equal "Huh?", @values[2]
62
+ assert_equal "Foo", @values[3]
63
+ end
62
64
 
63
- it "should return a value from the first bike cycle order" do
64
- assert_equal "I", @sub_values[0][0]
65
- assert_equal "just", @sub_values[0][1]
66
- assert_equal "want", @sub_values[0][2]
67
- assert_equal "to", @sub_values[0][3]
68
- assert_equal "ride", @sub_values[0][4]
69
- assert_equal "I", @sub_values[0][0]
70
- end
65
+ it "should return a value from the first bike cycle order" do
66
+ assert_equal "I", @sub_values[0][0]
67
+ assert_equal "just", @sub_values[0][1]
68
+ assert_equal "want", @sub_values[0][2]
69
+ assert_equal "to", @sub_values[0][3]
70
+ assert_equal "ride", @sub_values[0][4]
71
+ assert_equal "I", @sub_values[0][0]
72
+ end
71
73
 
72
- it "should return a value from the second bike cycle order" do
73
- assert_equal "I", @sub_values[1][0]
74
- assert_equal "just", @sub_values[1][1]
75
- assert_equal "want", @sub_values[1][2]
76
- assert_equal "to", @sub_values[1][3]
77
- assert_equal "ride", @sub_values[1][4]
78
- assert_equal "I", @sub_values[1][0]
79
- end
74
+ it "should return a value from the second bike cycle order" do
75
+ assert_equal "I", @sub_values[1][0]
76
+ assert_equal "just", @sub_values[1][1]
77
+ assert_equal "want", @sub_values[1][2]
78
+ assert_equal "to", @sub_values[1][3]
79
+ assert_equal "ride", @sub_values[1][4]
80
+ assert_equal "I", @sub_values[1][0]
81
+ end
80
82
 
81
- it "should return a value from the third bike cycle order" do
82
- assert_equal "I", @sub_values[2][0]
83
- assert_equal "just", @sub_values[2][1]
84
- assert_equal "want", @sub_values[2][2]
85
- assert_equal "to", @sub_values[2][3]
86
- assert_equal "ride", @sub_values[2][4]
87
- assert_equal "I", @sub_values[2][0]
88
- end
89
- end
83
+ it "should return a value from the third bike cycle order" do
84
+ assert_equal "I", @sub_values[2][0]
85
+ assert_equal "just", @sub_values[2][1]
86
+ assert_equal "want", @sub_values[2][2]
87
+ assert_equal "to", @sub_values[2][3]
88
+ assert_equal "ride", @sub_values[2][4]
89
+ assert_equal "I", @sub_values[2][0]
90
+ end
91
+ end
90
92
 
91
- describe "finding its current cycle" do
92
- before do
93
- @values = []
94
- @current = []
95
- for i in (0..5)
96
- @values[i] = cycle("I", "just", "want", "to", "ride")
97
- @current[i] = current_cycle
98
- end
99
- end
93
+ describe "finding its current cycle" do
94
+ before do
95
+ @values = []
96
+ @current = []
97
+ (0..5).each do |i|
98
+ @values[i] = cycle("I", "just", "want", "to", "ride")
99
+ @current[i] = current_cycle
100
+ end
101
+ end
100
102
 
101
- it "should match whats cycled" do
102
- for i in (0..5)
103
- assert_equal @values[i], @current[i]
104
- end
105
- end
106
- end
107
- end
103
+ it "should match whats cycled" do
104
+ (0..5).each do |i|
105
+ assert_equal @values[i], @current[i]
106
+ end
107
+ end
108
+ end
109
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bicycle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stuart Chinery
@@ -9,64 +9,78 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-06 00:00:00.000000000 Z
12
+ date: 2018-04-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: minitest
15
+ name: bundler
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
20
  version: '0'
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - "~>"
25
+ - - ">="
26
26
  - !ruby/object:Gem::Version
27
27
  version: '0'
28
28
  - !ruby/object:Gem::Dependency
29
- name: yard
29
+ name: jeweler
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - "~>"
32
+ - - ">="
33
33
  - !ruby/object:Gem::Version
34
- version: '0.6'
34
+ version: '0'
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - "~>"
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
- version: '0.6'
41
+ version: '0'
42
42
  - !ruby/object:Gem::Dependency
43
- name: bundler
43
+ name: minitest
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - "~>"
46
+ - - ">="
47
47
  - !ruby/object:Gem::Version
48
48
  version: '0'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - "~>"
53
+ - - ">="
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
56
  - !ruby/object:Gem::Dependency
57
- name: jeweler
57
+ name: turn
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - "~>"
60
+ - - ">="
61
61
  - !ruby/object:Gem::Version
62
- version: '1.6'
62
+ version: '0'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - "~>"
67
+ - - ">="
68
68
  - !ruby/object:Gem::Version
69
- version: '1.6'
69
+ version: '0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: yard
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
70
84
  description: A convenience gem for cycling through a set of values, ported from the
71
85
  'cycle' functionality found in Rails. It is independent of which framework you use
72
86
  so will run in Sinatra, Padrino or straight up Ruby itself.
@@ -78,6 +92,10 @@ extra_rdoc_files:
78
92
  - README.md
79
93
  files:
80
94
  - ".document"
95
+ - ".rubocop.yml"
96
+ - ".ruby-gemset"
97
+ - ".ruby-version"
98
+ - ".travis.yml"
81
99
  - Gemfile
82
100
  - Gemfile.lock
83
101
  - LICENSE.txt
@@ -86,6 +104,7 @@ files:
86
104
  - VERSION
87
105
  - bicycle.gemspec
88
106
  - lib/bicycle.rb
107
+ - lib/bicycle/methods.rb
89
108
  - test/helper.rb
90
109
  - test/test_bicycle.rb
91
110
  homepage: http://github.com/sleepingstu/bicycle
@@ -108,8 +127,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
127
  version: '0'
109
128
  requirements: []
110
129
  rubyforge_project:
111
- rubygems_version: 2.6.8
130
+ rubygems_version: 2.6.13
112
131
  signing_key:
113
- specification_version: 3
132
+ specification_version: 4
114
133
  summary: Why walk when you can cycle
115
134
  test_files: []