karashi 0.1.0

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 041c149974150b68d5ea9b90ecfcd6f012a13fb4
4
+ data.tar.gz: dca3fe5284e52fa3ddcc72ca88f6891c9b1198b1
5
+ SHA512:
6
+ metadata.gz: b1df82487944a10888f021a8e554efe10868a547d5827ae61b58e00e256f8a026cb7a1e41dee0386e4c448b209edb52c466e6ee77fb8ccc63129962fe32ab4f6
7
+ data.tar.gz: 242f4c20cd8e8b3fe2631c276c284a8da607ac45bf289cb965d09073414695c8ebf15c75b8d2cc83346a6f87eafe34ae891c7d816eca5ab9dc5436e7b0aeb71f
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.4
5
+ before_install: gem install bundler -v 1.15.4
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at TODO: Write your email address. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in karashi.gemspec
6
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2017 Naoki Watanabe
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 TODO: Write your name
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,72 @@
1
+ # Karashi
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/karashi`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'karashi'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install karashi
22
+
23
+ ## Usage
24
+
25
+ 23区の駅の取得
26
+ ```ruby
27
+ Karashi::Station.all_tokyo23
28
+ #=> Array of Karashi::Station Object
29
+
30
+ Karashi::Station.all_tokyo23.map{|station| station.name}
31
+ #=> ["東京", "新橋", "品川", ... ]
32
+ ```
33
+
34
+ 駅の詳細情報の取得
35
+ ```ruby
36
+ station_object = Karashi::Station.all_tokyo23[0]
37
+ #=> #<Karashi::Station:0x000055cd51f158 ... >
38
+ station_object.name
39
+ #=> "東京"
40
+ station_object.code
41
+ #=> "1130101"
42
+ station_object.city
43
+ #=> "千代田区"
44
+ ```
45
+
46
+ 駅コードから検索
47
+ ```ruby
48
+ station_object = Karashi::Station.find_by_code("1130101")
49
+ #=> #<Karashi::Station:0x000055cd51f158 ... >
50
+ station_object.name
51
+ #=> "東京"
52
+ station_object.city
53
+ #=> "千代田区"
54
+ ```
55
+
56
+ ## Development
57
+
58
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
59
+
60
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
61
+
62
+ ## Contributing
63
+
64
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/karashi. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
65
+
66
+ ## License
67
+
68
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
69
+
70
+ ## Code of Conduct
71
+
72
+ Everyone interacting in the Karashi project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/karashi/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "karashi"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/karashi.gemspec ADDED
@@ -0,0 +1,36 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "karashi/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "karashi"
8
+ spec.version = Karashi::VERSION
9
+ spec.authors = ["Naoki Watanabe"]
10
+ spec.email = ["naoki.watanabe@ikina.org"]
11
+
12
+ spec.summary = %q{todo: Write a short summary, because Rubygems requires one.}
13
+ spec.description = %q{todo: Write a longer description or delete this line.}
14
+ spec.homepage = "https://github.com/naoki-watanabe/karashi"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ #if spec.respond_to?(:metadata)
20
+ # spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
21
+ #else
22
+ # raise "RubyGems 2.0 or newer is required to protect against " \
23
+ # "public gem pushes."
24
+ #end
25
+
26
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
27
+ f.match(%r{^(test|spec|features)/})
28
+ end
29
+ spec.bindir = "exe"
30
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
+ spec.require_paths = ["lib"]
32
+
33
+ spec.add_development_dependency "bundler", "~> 1.15"
34
+ spec.add_development_dependency "rake", "~> 10.0"
35
+ spec.add_development_dependency "rspec", "~> 3.0"
36
+ end
data/lib/karashi.rb ADDED
@@ -0,0 +1,7 @@
1
+ require "karashi/version"
2
+ require "karashi/station"
3
+ require "karashi/loader"
4
+
5
+ module Karashi
6
+ # Your code goes here...
7
+ end
@@ -0,0 +1,68 @@
1
+ {
2
+ "stations":[
3
+ { "code":"1130101", "name":"東京", "kana":"とうきょう", "romaji":"tokyo", "city":"千代田区" },
4
+ { "code":"1130102", "name":"新橋", "kana":"しんばし", "romaji":"shinbashi", "city":"港区" },
5
+ { "code":"1130103", "name":"品川", "kana":"しながわ", "romaji":"shinagawa", "city":"港区" },
6
+ { "code":"1130201", "name":"大崎", "kana":"おおさき", "romaji":"osaki", "city":"品川区" },
7
+ { "code":"1130202", "name":"五反田", "kana":"ごたんだ", "romaji":"gotanda", "city":"品川区" },
8
+ { "code":"1130203", "name":"目黒", "kana":"めぐろ", "romaji":"meguro", "city":"品川区" },
9
+ { "code":"1130204", "name":"恵比寿", "kana":"えびす", "romaji":"ebisu", "city":"渋谷区" },
10
+ { "code":"1130205", "name":"渋谷", "kana":"しぶや", "romaji":"shibuya", "city":"渋谷区" },
11
+ { "code":"1130206", "name":"原宿", "kana":"はらじゅく", "romaji":"harajuku", "city":"渋谷区" },
12
+ { "code":"1130207", "name":"代々木", "kana":"よよぎ", "romaji":"yoyogi", "city":"渋谷区" },
13
+ { "code":"1130208", "name":"新宿", "kana":"しんじゅく", "romaji":"shinjuku", "city":"新宿区" },
14
+ { "code":"1130209", "name":"新大久保", "kana":"しんおおくぼ", "romaji":"shin-okubo", "city":"新宿区" },
15
+ { "code":"1130210", "name":"高田馬場", "kana":"たかだのばば", "romaji":"takadanobaba", "city":"新宿区" },
16
+ { "code":"1130211", "name":"目白", "kana":"めじろ", "romaji":"mejiro", "city":"豊島区" },
17
+ { "code":"1130212", "name":"池袋", "kana":"いけぶくろ", "romaji":"ikebukuro", "city":"豊島区" },
18
+ { "code":"1130213", "name":"大塚", "kana":"おおつか", "romaji":"otsuka", "city":"豊島区" },
19
+ { "code":"1130214", "name":"巣鴨", "kana":"すがも", "romaji":"sugamo", "city":"豊島区" },
20
+ { "code":"1130215", "name":"駒込", "kana":"こまごめ", "romaji":"komagome", "city":"豊島区" },
21
+ { "code":"1130216", "name":"田端", "kana":"たばた", "romaji":"tabata", "city":"北区" },
22
+ { "code":"1130217", "name":"西日暮里", "kana":"にしにっぽり", "romaji":"nishi-nippori", "city":"荒川区" },
23
+ { "code":"1130218", "name":"日暮里", "kana":"にっぽり", "romaji":"nippori", "city":"荒川区" },
24
+ { "code":"1130219", "name":"鶯谷", "kana":"うぐいすだに", "romaji":"uguisudani", "city":"台東区" },
25
+ { "code":"1130220", "name":"上野", "kana":"うえの", "romaji":"ueno", "city":"台東区" },
26
+ { "code":"1130221", "name":"御徒町", "kana":"おかちまち", "romaji":"okachimachi", "city":"台東区" },
27
+ { "code":"1130222", "name":"秋葉原", "kana":"あきはばら", "romaji":"akihabara", "city":"千代田区" },
28
+ { "code":"1130223", "name":"神田", "kana":"かんだ", "romaji":"kanda", "city":"千代田区" },
29
+ { "code":"1130225", "name":"有楽町", "kana":"ゆうらくちょう", "romaji":"yurakucho", "city":"千代田区" },
30
+ { "code":"1130227", "name":"浜松町", "kana":"はままつちょう", "romaji":"hamamatsucho", "city":"港区" },
31
+ { "code":"1130228", "name":"田町", "kana":"たまち", "romaji":"tamachi", "city":"港区" },
32
+ { "code":"1131102", "name":"四ツ谷", "kana":"よつや", "romaji":"yotsuya", "city":"新宿区" },
33
+ { "code":"1131216", "name":"阿佐ケ谷", "kana":"あさがや", "romaji":"asagaya", "city":"杉並区" },
34
+ { "code":"1131312", "name":"千駄ケ谷", "kana":"せんだがや", "romaji":"sendagaya", "city":"渋谷区" },
35
+ { "code":"1131315", "name":"市ケ谷", "kana":"いちがや", "romaji":"ichigaya", "city":"新宿区" },
36
+ { "code":"1131316", "name":"飯田橋", "kana":"いいだばし", "romaji":"idabashi", "city":"千代田区" },
37
+ { "code":"1132605", "name":"新木場", "kana":"しんきば", "romaji":"shinkiba", "city":"江東区" },
38
+ { "code":"2100201", "name":"浅草", "kana":"あさくさ", "romaji":"asakusa", "city":"台東区" },
39
+ { "code":"2100206", "name":"鐘ヶ淵", "kana":"かねがふち", "romaji":"kanegafuchi", "city":"墨田区" },
40
+ { "code":"2200301", "name":"小竹向原", "kana":"こたけむかいはら", "romaji":"kotake-mukaihara", "city":"練馬区" },
41
+ { "code":"2300101", "name":"京成上野", "kana":"けいせいうえの", "romaji":"keisei-ueno", "city":"台東区" },
42
+ { "code":"2300109", "name":"青砥", "kana":"あおと", "romaji":"aoto", "city":"葛飾区" },
43
+ { "code":"2300110", "name":"京成高砂", "kana":"けいせいたかさご", "romaji":"keisei-takasago", "city":"葛飾区" },
44
+ { "code":"2400103", "name":"幡ヶ谷", "kana":"はたがや", "romaji":"hatagaya", "city":"渋谷区" },
45
+ { "code":"2400613", "name":"富士見ヶ丘", "kana":"ふじみがおか", "romaji":"fujimigaoka", "city":"杉並区" },
46
+ { "code":"2500109", "name":"梅ヶ丘", "kana":"うめがおか", "romaji":"umegaoka", "city":"世田谷区" },
47
+ { "code":"2500113", "name":"祖師ヶ谷大蔵", "kana":"そしがやおおくら", "romaji":"soshigaya-okura", "city":"世田谷区" },
48
+ { "code":"2700207", "name":"羽田空港国際線ターミナル", "kana":"はねだくうこうこくさいせんたーみなる", "romaji":"haneda-airport-international-terminal", "city":"大田区" },
49
+ { "code":"2800404", "name":"早稲田", "kana":"わせだ", "romaji":"waseda", "city":"新宿区" },
50
+ { "code":"2800604", "name":"平和台", "kana":"へいわだい", "romaji":"heiwadai", "city":"練馬区" },
51
+ { "code":"2800605", "name":"氷川台", "kana":"ひかわだい", "romaji":"hikawadai", "city":"練馬区" },
52
+ { "code":"2800607", "name":"千川", "kana":"せんかわ", "romaji":"senkawa", "city":"豊島区" },
53
+ { "code":"2800608", "name":"要町", "kana":"かなめちょう", "romaji":"kanamecho", "city":"豊島区" },
54
+ { "code":"2800610", "name":"東池袋", "kana":"ひがしいけぶくろ", "romaji":"higashi-ikebukuro", "city":"豊島区" },
55
+ { "code":"2800611", "name":"護国寺", "kana":"ごこくじ", "romaji":"gokokuji", "city":"文京区" },
56
+ { "code":"2800612", "name":"江戸川橋", "kana":"えどがわばし", "romaji":"edogawabashi", "city":"文京区" },
57
+ { "code":"2800615", "name":"麹町", "kana":"こうじまち", "romaji":"kojimachi", "city":"千代田区" },
58
+ { "code":"2800617", "name":"桜田門", "kana":"さくらだもん", "romaji":"sakuradamon", "city":"千代田区" },
59
+ { "code":"2800619", "name":"銀座一丁目", "kana":"ぎんざいっちょうめ", "romaji":"ginza-ichome", "city":"中央区" },
60
+ { "code":"2800620", "name":"新富町", "kana":"しんとみちょう", "romaji":"shintomicho", "city":"中央区" },
61
+ { "code":"2800621", "name":"月島", "kana":"つきしま", "romaji":"tsukishima", "city":"中央区" },
62
+ { "code":"2800622", "name":"豊洲", "kana":"とよす", "romaji":"toyosu", "city":"江東区" },
63
+ { "code":"2800623", "name":"辰巳", "kana":"たつみ", "romaji":"tatsumi", "city":"江東区" },
64
+ { "code":"2800905", "name":"西ケ原", "kana":"にしがはら", "romaji":"nishigahara", "city":"北区" },
65
+ { "code":"9930519", "name":"西ヶ原四丁目", "kana":"にしがはらよんちょうめ", "romaji":"nishigahara-yonchome", "city":"北区" },
66
+ { "code":"9930526", "name":"都電雑司ヶ谷", "kana":"とでんぞうしがや", "romaji":"toden-zoshigaya", "city":"豊島区" }
67
+ ]
68
+ }
@@ -0,0 +1,16 @@
1
+ require 'json'
2
+ module Karashi
3
+ class Loader
4
+ class << self
5
+ def load_stations
6
+ JSON.parse(File.read(File.join(data_path, "stations.json")))
7
+ end
8
+
9
+ private
10
+
11
+ def data_path
12
+ File.expand_path("../data", __FILE__)
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,49 @@
1
+ module Karashi
2
+ class Station
3
+ class << self
4
+
5
+ # find all Stations in tokyo 23 wards
6
+ def all_tokyo23
7
+ data
8
+ end
9
+
10
+ def find_by_code(code)
11
+ data_by_code[code]
12
+ end
13
+
14
+ def find_by_name(name)
15
+ data_by_name[name]
16
+ end
17
+
18
+ private
19
+
20
+ def data_by_code
21
+ return @data_by_code unless @data_by_code.nil?
22
+ @data_by_code = {}
23
+ data.each{|station| @data_by_code[station.code] = station }
24
+ @data_by_code
25
+ end
26
+
27
+ def data_by_name
28
+ return @data_by_name unless @data_by_name.nil?
29
+ @data_by_name = {}
30
+ data.each{|station| @data_by_name[station.name] = station }
31
+ @data_by_name
32
+ end
33
+
34
+ def data
35
+ @data ||= Karashi::Loader.load_stations["stations"].map{|station_data| new(station_data) }
36
+ end
37
+ end
38
+
39
+ def initialize(data)
40
+ @data = data
41
+ end
42
+
43
+ [:code, :name, :kana, :romaji, :city].each do |method_name_symbol|
44
+ define_method method_name_symbol do
45
+ @data[method_name_symbol.to_s]
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,3 @@
1
+ module Karashi
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,103 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: karashi
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Naoki Watanabe
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-11-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.15'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.15'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ description: 'todo: Write a longer description or delete this line.'
56
+ email:
57
+ - naoki.watanabe@ikina.org
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".rspec"
64
+ - ".travis.yml"
65
+ - CODE_OF_CONDUCT.md
66
+ - Gemfile
67
+ - LICENSE
68
+ - LICENSE.txt
69
+ - README.md
70
+ - Rakefile
71
+ - bin/console
72
+ - bin/setup
73
+ - karashi.gemspec
74
+ - lib/karashi.rb
75
+ - lib/karashi/data/stations.json
76
+ - lib/karashi/loader.rb
77
+ - lib/karashi/station.rb
78
+ - lib/karashi/version.rb
79
+ homepage: https://github.com/naoki-watanabe/karashi
80
+ licenses:
81
+ - MIT
82
+ metadata: {}
83
+ post_install_message:
84
+ rdoc_options: []
85
+ require_paths:
86
+ - lib
87
+ required_ruby_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ required_rubygems_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ requirements: []
98
+ rubyforge_project:
99
+ rubygems_version: 2.6.13
100
+ signing_key:
101
+ specification_version: 4
102
+ summary: 'todo: Write a short summary, because Rubygems requires one.'
103
+ test_files: []