liner 0.2.2 → 0.2.3

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: dad0b6535c04ddf76fad05584ad64b4c379187f7
4
- data.tar.gz: 75233cdd3a40e5d9a126f46fc12b510a137e6276
3
+ metadata.gz: 04e738b13c18717baf4af8a6fba875a9b10336ee
4
+ data.tar.gz: d5237a43626168160673d7415ec86267493922ac
5
5
  SHA512:
6
- metadata.gz: 757c14e3eafdf3619452c3b9c2e3276e2e8830aef5af1cea231f44d1319ede9fae6ca213f405ae02c366b64b61e2db5a1f1413597e816338ffabfd89379bdd9f
7
- data.tar.gz: 4fce92aab596458b658e3b4e03193b2004489c1ccc926f71c7a8433108dcd8150cb2241cea8d9e6c4eb4cb142b8fbd32392ed1cf2165afca710eab0a6434f48d
6
+ metadata.gz: 17b755696b49dda44fc5b4bda27205027a976b1f98a4c173dfc875b742ccd5c76a0ffa10c7ba738ec6546eeb13ad17d36ca235f46e68dc9988e509f8da28d97c
7
+ data.tar.gz: 79618b91225d393a1cd4b283fc34deb6d425280acce524188dee69a49eef772f3e1cfad80d82936806b90077a195c40b3c7d54b7f29410c266b611434cee71a4
@@ -2,11 +2,13 @@ language: ruby
2
2
  cache: bundler
3
3
  bundler_args: --without yard pry
4
4
  rvm:
5
+ - ree
6
+ - 1.8.7
7
+ - 1.9.2
5
8
  - 1.9.3
6
9
  - 2.0.0
7
10
  - 2.1.0
8
11
  - ruby-head
9
- - rbx
10
12
  - rbx-2
11
13
  matrix:
12
14
  include:
@@ -14,7 +16,7 @@ matrix:
14
16
  env: JRUBY_OPTS="$JRUBY_OPTS --debug"
15
17
  - rvm: jruby-head
16
18
  env: JRUBY_OPTS="$JRUBY_OPTS --debug"
17
- allow_failure:
19
+ allow_failures:
18
20
  - rvm: ruby-head
19
21
  - rvm: jruby-head
20
22
  fast_finish: true
data/README.md CHANGED
@@ -179,11 +179,14 @@ Guitar.new('C', 6)
179
179
  This library aims to support and is tested against the following Ruby
180
180
  implementations:
181
181
 
182
+ * Ruby 1.8.7
183
+ * Ruby 1.9.2
182
184
  * Ruby 1.9.3
183
185
  * Ruby 2.0.0
184
186
  * Ruby 2.1.0
185
187
  * [JRuby](http://jruby.org/)
186
188
  * [Rubinius](http://rubini.us/)
189
+ * [Ruby Enterprise Edition](http://www.rubyenterpriseedition.com/)
187
190
 
188
191
  If something doesn't work on one of these versions, it's a bug.
189
192
 
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
1
  require "bundler/gem_tasks"
2
2
 
3
- task default: [:test]
3
+ task :default => [:test]
4
4
 
5
5
  task :test do
6
6
  $LOAD_PATH.unshift('lib', 'spec')
@@ -25,7 +25,9 @@ module Liner
25
25
  def Liner.apply!(base, *keys)
26
26
  keys = keys.map(&:to_sym).uniq
27
27
 
28
- base.send(:define_singleton_method, :liner_keys) do
28
+ singleton = (class << base; self; end)
29
+
30
+ singleton.send(:define_method, :liner_keys) do
29
31
  @liner_keys ||= begin
30
32
  super() + keys
31
33
  rescue NoMethodError
@@ -1,3 +1,3 @@
1
1
  module Liner
2
- VERSION = '0.2.2'
2
+ VERSION = '0.2.3'
3
3
  end
@@ -18,8 +18,10 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
+ spec.add_dependency "json" if RUBY_VERSION < '1.9.2'
22
+
21
23
  spec.add_development_dependency "bundler", "~> 1.3"
22
24
  spec.add_development_dependency "rake"
23
25
  spec.add_development_dependency "minitest"
24
- spec.add_development_dependency "coveralls"
26
+ spec.add_development_dependency "coveralls" if RUBY_VERSION > '1.8.7'
25
27
  end
@@ -1,7 +1,7 @@
1
1
  describe Liner::Base do
2
2
  describe :initialize do
3
3
  it "should accept key/value pairs" do
4
- beer = Beer.new(hops: 'Cascade', yeast: 'Top Fermenting')
4
+ beer = Beer.new(:hops => 'Cascade', :yeast => 'Top Fermenting')
5
5
  beer.hops.must_equal 'Cascade'
6
6
  beer.yeast.must_equal 'Top Fermenting'
7
7
  end
@@ -1,19 +1,19 @@
1
1
  describe Liner::Equalizable do
2
- subject { Pizza.new(crust: 'thin', sauce: 'tomato') }
2
+ subject { Pizza.new(:crust => 'thin', :sauce => 'tomato') }
3
3
  describe "#==" do
4
4
  it "should return true when hashes are equal" do
5
- subject.must_be :==, Pizza.new(crust: 'thin', sauce: 'tomato')
5
+ subject.must_be :==, Pizza.new(:crust => 'thin', :sauce => 'tomato')
6
6
  end
7
7
  it "should return false when hashes are not equal" do
8
- subject.wont_be :==, Pizza.new(crust: 'thick', sauce: 'alfredo')
8
+ subject.wont_be :==, Pizza.new(:crust => 'thick', :sauce => 'alfredo')
9
9
  end
10
10
  end
11
11
  describe "#eql?" do
12
12
  it "should return true when hashes are equal" do
13
- subject.must_be :eql?, Pizza.new(crust: 'thin', sauce: 'tomato')
13
+ subject.must_be :eql?, Pizza.new(:crust => 'thin', :sauce => 'tomato')
14
14
  end
15
15
  it "should return false when hashes are not equal" do
16
- subject.wont_be :eql?, Pizza.new(crust: 'thick', sauce: 'alfredo')
16
+ subject.wont_be :eql?, Pizza.new(:crust => 'thick', :sauce => 'alfredo')
17
17
  end
18
18
  end
19
19
  end
@@ -1,5 +1,5 @@
1
1
  describe Liner::Hashable do
2
- subject { Beer.new(hops: 'Cascade') }
2
+ subject { Beer.new(:hops => 'Cascade') }
3
3
 
4
4
  it "#[] should read attributes" do
5
5
  subject[:hops].must_equal "Cascade"
@@ -7,7 +7,7 @@ describe Liner::Hashable do
7
7
  end
8
8
 
9
9
  it "[] should not read invalid attributes" do
10
- ->{ subject[:foo] }.must_raise ArgumentError
10
+ Proc.new { subject[:foo] }.must_raise ArgumentError
11
11
  end
12
12
 
13
13
  it "#[]= should set attributes" do
@@ -16,21 +16,21 @@ describe Liner::Hashable do
16
16
  end
17
17
 
18
18
  it "#[]= should not set invalid attributes" do
19
- ->{ subject[:foo] = 'bar' }.must_raise ArgumentError
19
+ Proc.new { subject[:foo] = 'bar' }.must_raise ArgumentError
20
20
  end
21
21
 
22
22
  it "liner should be a hash of attributes" do
23
- subject.liner.must_equal({ hops: 'Cascade', yeast: nil })
23
+ subject.liner.must_equal({ :hops => 'Cascade', :yeast => nil })
24
24
  end
25
25
 
26
26
  it "liner= should set the attributes" do
27
- hash = {hops: 'Columbus', yeast: 'Bottom Fermenting' }
27
+ hash = {:hops => 'Columbus', :yeast => 'Bottom Fermenting' }
28
28
  subject.liner = hash
29
29
  subject.liner.must_equal(hash)
30
30
  end
31
31
 
32
32
  it "#to_h should return the attribute hash" do
33
- subject.to_h.must_equal({ hops: 'Cascade', yeast: nil })
33
+ subject.to_h.must_equal({ :hops => 'Cascade', :yeast => nil })
34
34
  end
35
35
 
36
36
  end
@@ -1,9 +1,17 @@
1
1
  describe Liner::Inspectable do
2
- subject { Cheeseburger.new(meat: 'turkey') }
2
+ subject { Cheeseburger.new(:meat => 'turkey') }
3
3
  it "#inspect must include all attributes" do
4
- subject.inspect.must_equal '#<Cheeseburger bun=nil, meat="turkey", cheese=nil>'
4
+ subject.to_s.must_include '#<Cheeseburger'
5
+ subject.to_s.must_include '>'
6
+ subject.to_s.must_include 'bun=nil'
7
+ subject.to_s.must_include 'meat="turkey"'
8
+ subject.to_s.must_include 'cheese=nil'
5
9
  end
6
10
  it "#to_s must include all attributes" do
7
- subject.to_s.must_equal '#<Cheeseburger bun=nil, meat="turkey", cheese=nil>'
11
+ subject.to_s.must_include '#<Cheeseburger'
12
+ subject.to_s.must_include '>'
13
+ subject.to_s.must_include 'bun=nil'
14
+ subject.to_s.must_include 'meat="turkey"'
15
+ subject.to_s.must_include 'cheese=nil'
8
16
  end
9
17
  end
@@ -1,8 +1,8 @@
1
1
  describe Liner do
2
2
  describe :new do
3
- let(:beer) { Beer.new(hops: 'columbus') }
4
- let(:pizza) { Pizza.new(crust: 'thin') }
5
- let(:cheeseburger){ Cheeseburger.new(bun: 'sesame') }
3
+ let(:beer) { Beer.new(:hops => 'columbus') }
4
+ let(:pizza) { Pizza.new(:crust => 'thin') }
5
+ let(:cheeseburger){ Cheeseburger.new(:bun => 'sesame') }
6
6
 
7
7
  it "should create a new class" do
8
8
  [Beer, Pizza, Burger, Cheeseburger].all?{|klass| klass.is_a? Class }
@@ -1,5 +1,7 @@
1
- require 'coveralls'
2
- Coveralls.wear!
1
+ if RUBY_VERSION > '1.8.7'
2
+ require 'coveralls'
3
+ Coveralls.wear!
4
+ end
3
5
 
4
6
  require 'minitest/autorun'
5
7
  require 'minitest/pride'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: liner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Lewis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-02 00:00:00.000000000 Z
11
+ date: 2014-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler