bcardarella-coder 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.3.0
data/coder.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{coder}
8
- s.version = "0.2.0"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Brian Cardarella"]
@@ -1,13 +1,13 @@
1
1
  module Coder
2
2
  class Countries
3
- attr_accessor :loaded_countries
3
+ attr_accessor :countries
4
4
 
5
5
  def initialize
6
6
  self.load_yaml
7
7
  end
8
8
 
9
9
  def load_yaml
10
- self.loaded_countries = YAML.load_file(yaml_file_name)
10
+ self.countries = YAML.load_file(yaml_file_name)
11
11
  end
12
12
 
13
13
  def yaml_file_name
@@ -16,13 +16,12 @@ module Coder
16
16
 
17
17
  def [](_code)
18
18
  _code = _code.to_s.upcase.to_sym
19
- country = loaded_countries[_code]
19
+ country = countries[_code]
20
20
  Coder::Country.new(:code => _code.to_s, :name => country)
21
21
  end
22
22
 
23
23
  def self.[](_code)
24
- countries = self.new
25
- countries[_code]
24
+ self.new[_code]
26
25
  end
27
26
  end
28
27
  end
@@ -1,6 +1,6 @@
1
1
  module Coder
2
2
  class Country
3
- attr_accessor :loaded_states, :code, :name
3
+ attr_accessor :states, :code, :name
4
4
 
5
5
  def initialize(args)
6
6
  self.code = args[:code].to_s
@@ -10,7 +10,7 @@ module Coder
10
10
  end
11
11
 
12
12
  def load_yaml
13
- self.loaded_states = YAML.load_file(yaml_file_name)
13
+ self.states = YAML.load_file(yaml_file_name)
14
14
  end
15
15
 
16
16
  def yaml_file_name
@@ -19,7 +19,7 @@ module Coder
19
19
 
20
20
  def [](_code)
21
21
  _code = _code.to_s.upcase.to_sym
22
- state = loaded_states[_code]
22
+ state = states[_code]
23
23
  Coder::State.new(:code => _code.to_s, :name => state)
24
24
  end
25
25
 
@@ -1,2 +1,60 @@
1
1
  ---
2
- :MA: Massachusetts
2
+ :HI: Hawaii
3
+ :KY: Kentucky
4
+ :MN: Minnesota
5
+ :OK: Oklahoma
6
+ :FM: Federated States Of Micronesia
7
+ :MT: Montana
8
+ :NJ: New Jersey
9
+ :PW: Palau
10
+ :SD: South Dakota
11
+ :VI: Virgin Islands
12
+ :WA: Washington
13
+ :DE: Delaware
14
+ :IA: Iowa
15
+ :MO: Missouri
16
+ :OR: Oregon
17
+ :AK: Alaska
18
+ :MH: Marshall Islands
19
+ :NM: New Mexico
20
+ :WV: West Virginia
21
+ :ID: Idaho
22
+ :IL: Illinois
23
+ :KS: Kansas
24
+ :LA: Louisiana
25
+ :MA: Massachusetts
26
+ :MP: Northern Mariana Islands
27
+ :RI: Rhode Island
28
+ :VA: Virginia
29
+ :CT: Connecticut
30
+ :NY: New York
31
+ :WI: Wisconsin
32
+ :GU: Guam
33
+ :MI: Michigan
34
+ :NC: North Carolina
35
+ :PR: Puerto Rico
36
+ :TX: Texas
37
+ :DC: District Of Columbia
38
+ :ND: North Dakota
39
+ :TN: T:Tnessee
40
+ :WY: Wyoming
41
+ :AR: Arkansas
42
+ :IN: Indiana
43
+ :MD: Maryland
44
+ :NE: Nebraska
45
+ :NV: Nevada
46
+ :UT: Utah
47
+ :AL: Alabama
48
+ :AZ: Arizona
49
+ :FL: Florida
50
+ :GA: Georgia
51
+ :OH: Ohio
52
+ :AS: American Samoa
53
+ :CA: California
54
+ :CO: Colorado
55
+ :ME: Maine
56
+ :MS: Mississippi
57
+ :NH: New Hampshire
58
+ :PA: Pennsylvania
59
+ :SC: South Carolina
60
+ :VT: Vermont
@@ -15,10 +15,10 @@ class CountriesTest < Test::Unit::TestCase
15
15
  assert_match /eng.yml/, @countries.yaml_file_name
16
16
  end
17
17
 
18
- should "set the #loaded_countries with the country data" do
18
+ should "set the #countries with the country data" do
19
19
  YAML.expects(:load_file).returns({:US => "United States"})
20
20
  @countries.load_yaml
21
- assert "United States", @countries.loaded_countries[:US]
21
+ assert "United States", @countries.countries[:US]
22
22
  end
23
23
  end
24
24
 
@@ -16,10 +16,10 @@ class CountryTest < Test::Unit::TestCase
16
16
  assert_match /us/, @country.yaml_file_name
17
17
  end
18
18
 
19
- should "set the #loaded_states with the US state data" do
19
+ should "set the #states with the US state data" do
20
20
  YAML.expects(:load_file).returns({:MA => "Massachusetts"})
21
21
  @country.load_yaml
22
- assert "Massachusetts", @country.loaded_states[:MA]
22
+ assert "Massachusetts", @country.states[:MA]
23
23
  end
24
24
  end
25
25
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bcardarella-coder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Cardarella