Class: Faker::Indian::Address

Inherits:
Object
  • Object
show all
Defined in:
lib/faker/indian/address.rb

Constant Summary collapse

LOCATIONS =
data.fetch(:locations).freeze
STREETS =
data.fetch(:streets).freeze
STATE_CODES =
data.fetch(:state_codes).freeze
DISTRICTS =
data.fetch(:districts).freeze
LANDMARKS =
data.fetch(:landmarks).freeze

Class Method Summary collapse

Class Method Details

.city(state: nil) ⇒ Object



17
18
19
# File 'lib/faker/indian/address.rb', line 17

def city(state: nil)
  sample_location(state: state)[:city]
end

.districtObject



33
34
35
# File 'lib/faker/indian/address.rb', line 33

def district
  DISTRICTS.sample(random: random)
end

.full_address(state: nil) ⇒ Object



45
46
47
48
# File 'lib/faker/indian/address.rb', line 45

def full_address(state: nil)
  loc = sample_location(state: state)
  "#{line1}, #{district}, #{loc[:city]}, #{loc[:state]} - #{loc[:pincode]}"
end

.landmarkObject



37
38
39
# File 'lib/faker/indian/address.rb', line 37

def landmark
  LANDMARKS.sample(random: random)
end

.line1Object



41
42
43
# File 'lib/faker/indian/address.rb', line 41

def line1
  "#{random_street_number} #{random_street}"
end

.pincode(state: nil) ⇒ Object



25
26
27
# File 'lib/faker/indian/address.rb', line 25

def pincode(state: nil)
  sample_location(state: state)[:pincode]
end

.state(state: nil) ⇒ Object



21
22
23
# File 'lib/faker/indian/address.rb', line 21

def state(state: nil)
  sample_location(state: state)[:state]
end

.state_code(state: nil) ⇒ Object



29
30
31
# File 'lib/faker/indian/address.rb', line 29

def state_code(state: nil)
  sample_location(state: state)[:state_code]
end