propinsi 0.0.2 → 0.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6b6a6f2750dd40bdd34526b96dc3e6ededbd1bff
4
- data.tar.gz: 2f7c164fb3a80289a10c2fa057ba90757819e47b
3
+ metadata.gz: 4cbbeef5bbb21bbda7a7445e734d7114a74e538f
4
+ data.tar.gz: f5f3f28d07d38dfbf90e93c7875948450eb8bf81
5
5
  SHA512:
6
- metadata.gz: ae2b80990bbd61d76ebfed95d3ba497624fbda9f1eb213cbaf3a2dfcc9ddced6db3f1bc302f3a5657eb64d9280b8a6a2ea7116f90b84360168bed9ab073007f8
7
- data.tar.gz: f21f7022d6f6a86e96a8a1eeeb4856b2f9b7f4131cf5a7c11cc0379bf0fd66716170e6e253f28c0252a7c9f1f58cc789cee48b822459d295142164f228d3b450
6
+ metadata.gz: 48f2f47de952b358b68df34efa16630fcabe23c6b3db095beee9f3550b828d156d966c746b6398396332986fd2e0d42c2809d21a9aa7085310c28d4e9ae7b5d1
7
+ data.tar.gz: f09764f059d42b7fb9c4944165b577d4e5b762055be87befcb232934d72365ce247243b990139aa187ee4b327442447a62175d6603212c922121ec183161f004
data/README.md CHANGED
@@ -19,11 +19,17 @@ Or install it yourself as:
19
19
 
20
20
  $ gem install propinsi
21
21
 
22
+ run
23
+
24
+ $ rails g propinsi:install
25
+
22
26
  after instalation there will be some new files
23
27
 
24
- lib/tasks/propinsi.rake
25
- model/province.rb
26
- model/city.rb
28
+ - lib/tasks/propinsi.rake
29
+ - db/migrate/yyyymmdd_create_cities.rb
30
+ - db/migrate/yyyymmdd_create_provinces.rb
31
+ - model/province.rb
32
+ - model/city.rb
27
33
 
28
34
  run:
29
35
 
@@ -40,27 +46,33 @@ to import all provinces and cities into your created table.
40
46
  ### Usage with database
41
47
  Since the province and city is already in your database, you can use it normaly as you call a table.
42
48
  To implement in a select box, you can use [collection select](http://guides.rubyonrails.org/form_helpers.html).
43
- `<%= collection_select(:user, :province_id, Province.all, :id, :name) %>`
49
+
50
+ `<%= collection_select(:user, :province_id, Province.all, :id, :name) %>`
44
51
 
45
52
  ### Usage without database
46
53
  If you do not want to use database, you can use our array based list.
47
54
 
48
55
  Display all data
49
- `Propinsi.all`
56
+
57
+ `Propinsi.all`
50
58
 
51
59
  Display all province
52
- `Propinsi.propinsi`
60
+
61
+ `Propinsi.propinsi`
53
62
 
54
63
  Find province based on ID or name
55
- `Propinsi.findpropinsi(1)`
56
- `Propinsi.findpropinsi("Aceh")`
64
+
65
+ `Propinsi.findpropinsi(1)`
66
+ `Propinsi.findpropinsi("Aceh")`
57
67
 
58
68
  Diplay all City
59
- `Propinsi.kota`
69
+
70
+ `Propinsi.kota`
60
71
 
61
72
  find city based on ID or name
62
- `Propinsi.findkota(2)`
63
- `Propoinsi.findkota(2)`
73
+
74
+ `Propinsi.findkota(2)` #Kabupaten Aceh Tenggara
75
+ `Propoinsi.findkota("bekasi")`
64
76
 
65
77
  ## Contributing
66
78
 
data/Rakefile CHANGED
@@ -3,5 +3,4 @@ Bundler::GemHelper.install_tasks
3
3
 
4
4
  require 'rspec/core'
5
5
  require 'rspec/core/rake_task'
6
-
7
- task :default => :spec
6
+ RSpec::Core::RakeTask.new(:spec)
data/lib/propinsi.rb CHANGED
@@ -23,7 +23,7 @@ module Propinsi
23
23
  def Propinsi.findkota(input)
24
24
  kota=self.kota;
25
25
  index=kota.each_with_index do |row,idx|
26
- break idx if(input.to_s == row["id"].to_s || input.to_s == row["name"].to_s)
26
+ break idx if(input.to_s == row["id"].to_s || row["name"].to_s.downcase.include? input.to_s.downcase)
27
27
  end
28
28
  if index.kind_of?(Array)
29
29
  return false;
@@ -36,7 +36,7 @@ module Propinsi
36
36
  def Propinsi.findpropinsi(input)
37
37
  prop=self.all
38
38
  index=prop.each_with_index do |row,idx|
39
- break idx if(input.to_s == row["id"].to_s || input.to_s == row["name"].to_s)
39
+ break idx if(input.to_s == row["id"].to_s || row["name"].to_s.downcase.include? input.to_s.downcase)
40
40
  end
41
41
  if index.kind_of?(Array)
42
42
  return false;
@@ -1,3 +1,3 @@
1
1
  module Propinsi
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: propinsi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Perdana Adhitama