usamap 0.0.1
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.
- data/lib/usa_counties_svg.rb +12634 -0
- data/lib/usamap.rb +19 -0
- metadata +47 -0
data/lib/usamap.rb
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require 'usa_counties_svg'
|
|
2
|
+
|
|
3
|
+
class USAmap
|
|
4
|
+
attr_accessor :stats_h, :colors_h
|
|
5
|
+
|
|
6
|
+
def initialize(stats_h = {}, colors_h = {})
|
|
7
|
+
@stats_h, @colors_h = stats_h, colors_h
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def to_s
|
|
11
|
+
css = ''
|
|
12
|
+
@stats_h.each do |fips, val|
|
|
13
|
+
colr = @colors_h.select { |range, hex| range.member?(val) }.values.first
|
|
14
|
+
css << ".c#{fips} {fill:#{colr}}\n"
|
|
15
|
+
end
|
|
16
|
+
@@svg.gsub!(/\/\*CSS insertion point\*\//, css)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: usamap
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
prerelease:
|
|
6
|
+
platform: ruby
|
|
7
|
+
authors:
|
|
8
|
+
- salemine
|
|
9
|
+
autorequire:
|
|
10
|
+
bindir: bin
|
|
11
|
+
cert_chain: []
|
|
12
|
+
date: 2013-04-05 00:00:00.000000000 Z
|
|
13
|
+
dependencies: []
|
|
14
|
+
description: A gem to draw a svg map of the USA by county
|
|
15
|
+
email: info@salemine.com
|
|
16
|
+
executables: []
|
|
17
|
+
extensions: []
|
|
18
|
+
extra_rdoc_files: []
|
|
19
|
+
files:
|
|
20
|
+
- lib/usamap.rb
|
|
21
|
+
- lib/usa_counties_svg.rb
|
|
22
|
+
homepage: https://github.com/salemine/usamap
|
|
23
|
+
licenses: []
|
|
24
|
+
post_install_message:
|
|
25
|
+
rdoc_options: []
|
|
26
|
+
require_paths:
|
|
27
|
+
- lib
|
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
29
|
+
none: false
|
|
30
|
+
requirements:
|
|
31
|
+
- - ! '>='
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
35
|
+
none: false
|
|
36
|
+
requirements:
|
|
37
|
+
- - ! '>='
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '0'
|
|
40
|
+
requirements: []
|
|
41
|
+
rubyforge_project:
|
|
42
|
+
rubygems_version: 1.8.23
|
|
43
|
+
signing_key:
|
|
44
|
+
specification_version: 3
|
|
45
|
+
summary: A map of the USA
|
|
46
|
+
test_files: []
|
|
47
|
+
has_rdoc:
|