jp_ski 0.0.1 → 0.0.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.
@@ -3,17 +3,18 @@ module JpSki
3
3
  class Ski
4
4
  attr_accessor :name, :pref, :area
5
5
 
6
- def self.build(name, pref, area)
6
+ def self.build(args)
7
7
  ski = new
8
- ski.name = name
9
- ski.pref = pref
10
- ski.area = area
8
+ args.each do |k, v|
9
+ ski.instance_variable_set("@#{k}", v) unless v.nil?
10
+ end
11
11
  ski
12
12
  end
13
13
 
14
14
  def self.all
15
15
  Mapping.data.map do |ski|
16
- build(ski[:name], ski[:pref], ski[:area])
16
+ build(:name => ski[:name], :pref => ski[:pref],
17
+ :area => ski[:area])
17
18
  end
18
19
  end
19
20
  end
@@ -1,3 +1,3 @@
1
1
  module JpSki
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -3,23 +3,27 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  describe JpSki::Ski do
6
- let(:ski) { JpSki::Ski.build('foo', 'bar', 'baz') }
7
- subject { ski }
6
+ describe 'with valid initialization' do
7
+ let(:ski) do
8
+ JpSki::Ski.build(:name => 'foo', :pref => 'bar', :area => 'baz')
9
+ end
10
+ subject { ski }
8
11
 
9
- it { is_expected.to respond_to(:name) }
10
- it { is_expected.to respond_to(:pref) }
11
- it { is_expected.to respond_to(:area) }
12
- it { expect(ski.name).to eq 'foo' }
13
- it { expect(ski.pref).to eq 'bar' }
14
- it { expect(ski.area).to eq 'baz' }
12
+ it { is_expected.to respond_to(:name) }
13
+ it { is_expected.to respond_to(:pref) }
14
+ it { is_expected.to respond_to(:area) }
15
+ it { expect(ski.name).to eq 'foo' }
16
+ it { expect(ski.pref).to eq 'bar' }
17
+ it { expect(ski.area).to eq 'baz' }
15
18
 
16
- describe '.all' do
17
- let(:skis) { JpSki::Ski.all }
19
+ describe '.all' do
20
+ let(:skis) { JpSki::Ski.all }
18
21
 
19
- it { expect(skis.first).to be_an_instance_of(JpSki::Ski) }
20
- it { expect(skis.first.name).to eq '石狩平原スキー場' }
21
- it { expect(skis.first.pref).to eq '北海道' }
22
- it { expect(skis.first.area).to eq '北海道' }
23
- it { expect(skis.count).to eq 563 }
22
+ it { expect(skis.first).to be_an_instance_of(JpSki::Ski) }
23
+ it { expect(skis.first.name).to eq '石狩平原スキー場' }
24
+ it { expect(skis.first.pref).to eq '北海道' }
25
+ it { expect(skis.first.area).to eq '北海道' }
26
+ it { expect(skis.count).to eq 563 }
27
+ end
24
28
  end
25
29
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jp_ski
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-01-19 00:00:00.000000000 Z
12
+ date: 2015-01-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -98,7 +98,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
98
98
  version: '0'
99
99
  segments:
100
100
  - 0
101
- hash: -4323743228023237767
101
+ hash: 395196206164858747
102
102
  required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  none: false
104
104
  requirements:
@@ -107,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
107
  version: '0'
108
108
  segments:
109
109
  - 0
110
- hash: -4323743228023237767
110
+ hash: 395196206164858747
111
111
  requirements: []
112
112
  rubyforge_project:
113
113
  rubygems_version: 1.8.23