stateface-rails 0.0.5 → 0.0.9

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.
@@ -1,8 +1,9 @@
1
1
  require 'stateface/rails'
2
+ require 'stateface/mappings'
2
3
 
3
4
  module Stateface
4
5
  def to_stateface
5
- "abcd"
6
+ Stateface::Mappings::ABBREVIATIONS[self.downcase.to_sym]
6
7
  end
7
8
  end
8
9
 
@@ -0,0 +1,58 @@
1
+ module Stateface
2
+ module Mappings
3
+ ABBREVIATIONS = {
4
+ us: "z",
5
+ ut: "r",
6
+ dc: "y",
7
+ de: "H",
8
+ ri: "m",
9
+ ar: "C",
10
+ az: "D",
11
+ ak: "A",
12
+ al: "B",
13
+ or: "k",
14
+ ok: "j",
15
+ oh: "i",
16
+ ia: "L",
17
+ in: "O",
18
+ il: "N",
19
+ id: "M",
20
+ wy: "x",
21
+ wi: "v",
22
+ wv: "w",
23
+ wa: "u",
24
+ la: "R",
25
+ fl: "I",
26
+ tx: "q",
27
+ tn: "p",
28
+ ct: "G",
29
+ co: "F",
30
+ ca: "E",
31
+ ky: "Q",
32
+ ks: "P",
33
+ nd: "b",
34
+ nc: "a",
35
+ ny: "h",
36
+ nm: "f",
37
+ nj: "e",
38
+ nh: "d",
39
+ nv: "g",
40
+ ne: "c",
41
+ hi: "K",
42
+ va: "s",
43
+ vt: "t",
44
+ sd: "o",
45
+ sc: "n",
46
+ pa: "l",
47
+ mt: "Z",
48
+ mo: "X",
49
+ ms: "Y",
50
+ mn: "W",
51
+ mi: "V",
52
+ ma: "S",
53
+ md: "T",
54
+ me: "U",
55
+ ga: "J"
56
+ }
57
+ end
58
+ end
@@ -1,5 +1,6 @@
1
1
  require 'stateface/rails/engine'
2
2
  require 'stateface/rails/version'
3
+
3
4
  require 'stateface/rails/railtie' if defined?(Rails)
4
5
 
5
6
  module Stateface
@@ -2,7 +2,7 @@ module Stateface
2
2
  module Rails
3
3
  module Helpers
4
4
  def stateface_tag(abbreviation)
5
-
5
+ content_tag(:span, abbreviation.to_stateface, :class => 'propublica-stateface')
6
6
  end
7
7
  end
8
8
  end
@@ -1,8 +1,9 @@
1
1
  require 'stateface/rails/helpers'
2
+
2
3
  module Stateface
3
4
  module Rails
4
- class Railtie < Rails::Railtie
5
- initializer "stateface.rails.helpers" do
5
+ class Railtie < ::Rails::Railtie
6
+ initializer "stateface.helpers" do
6
7
  ActionView::Base.send :include, Helpers
7
8
  end
8
9
  end
@@ -1,5 +1,5 @@
1
1
  module Stateface
2
2
  module Rails
3
- VERSION = "0.0.5"
3
+ VERSION = "0.0.9"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stateface-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -24,6 +24,7 @@ files:
24
24
  - README.md
25
25
  - Rakefile
26
26
  - lib/stateface-rails.rb
27
+ - lib/stateface/mappings.rb
27
28
  - lib/stateface/rails.rb
28
29
  - lib/stateface/rails/engine.rb
29
30
  - lib/stateface/rails/helpers.rb