indianize 1.3 → 1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/indianize.rb +22 -0
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 617cd0f4b7b6b1f3774be36175016d6b18193e6581c7cda60ed88f7ed888251f
4
- data.tar.gz: 61346c77645f4dc76c5cd91575ef1154b7ba20f9a42e7358b5005bbd6ed2dc09
3
+ metadata.gz: bb6795a68f8a55a3088876d4ab81092d33b0f06d2e8385225014b61fad8ae222
4
+ data.tar.gz: 917c9e5ebe96e37e4f8fe23a3f60ad976b01bc96057b96c42ba3331b453ef70d
5
5
  SHA512:
6
- metadata.gz: 9b49228ddf43c29f2d76d5dba99a5eddf9325a496869a27ee08c8a11ec9707cf5172d02e9a37f9c94774ee8ab95933c63348e3e613c65223bf727535c9bad84f
7
- data.tar.gz: 7562d9f725ba284b95c7664dd88e2b005370be1b587ed3835af97cf22d71cf40a65907e243b7312e2a6c43ecb0b4611fa96aa91b4cb97ff8c650f21eef6c8293
6
+ metadata.gz: dc8d6adc678c6a5c4a73212d1ca4acb8afe573277dbe4333d302b0b1b31786f7da45682af692ee0f65a2e6bcb4eb5cb8fe8c3a3462176c1e6a6af7c8b090f565
7
+ data.tar.gz: 196c2f27692acdb8bd744c5b5eac2da85833613b77b154a85ce353666ebb4a28d4d99d476914b50894541f06ab62efd435db86fb3ab477e70f9612f4b757c14e
data/lib/indianize.rb CHANGED
@@ -34,6 +34,14 @@ class Indianize
34
34
  1 => "one"
35
35
  }
36
36
 
37
+ @states_array = ["Andaman and Nicobar Islands", "Andhra Pradesh", "Arunachal Pradesh", "Assam",
38
+ "Bihar", "Chandigarh", "Chhattisgarh", "Dadra and Nagar Haveli", "Daman & Diu",
39
+ "Delhi", "Goa", "Gujarat", "Haryana", "Himachal Pradesh", "Jammu & Kashmir",
40
+ "Jharkhand", "Karnataka", "Kerala", "Lakshadweep", "Madhya Pradesh", "Maharashtra",
41
+ "Manipur", "Meghalaya", "Mizoram", "Nagaland", "Odisha", "Puducherry", "Punjab",
42
+ "Rajasthan", "Sikkim", "Tamil Nadu", "Telangana", "Tripura", "Uttar Pradesh",
43
+ "Uttarakhand", "West Bengal"]
44
+
37
45
  def self.to_number(value)
38
46
  "₹ " + value.round.to_s.gsub(/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/, "\\1,")
39
47
  end
@@ -56,4 +64,18 @@ class Indianize
56
64
  end
57
65
  end
58
66
  end
67
+
68
+ # states
69
+ def self.states
70
+ @states_array
71
+ end
72
+
73
+ def self.state_search(query)
74
+ result = []
75
+ @states_array.each do |x|
76
+ result << x if x.downcase.include?(query)
77
+ end
78
+ return result
79
+ end
80
+
59
81
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: indianize
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.3'
4
+ version: '1.4'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Himanshu G.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-11 00:00:00.000000000 Z
11
+ date: 2019-04-10 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Convert numbers to Indian currency numbering system with seperators,
14
14
  in numeric and alphabetical formats.