Module: BrighterPlanet::Residence
- Extended by:
- Emitter
- Included in:
- ResidenceRecord
- Defined in:
- lib/residence.rb,
lib/residence/data.rb,
lib/residence/fallback.rb,
lib/residence/carbon_model.rb,
lib/residence/relationships.rb,
lib/residence/summarization.rb,
lib/residence/characterization.rb
Defined Under Namespace
Modules: CarbonModel, Characterization, Data, Fallback, Relationships, Summarization
Constant Summary
collapse
- ROOMS =
[
[:bedroom, { :max_count => 10, :multiplier => 1 }],
[:living_room, { :max_count => 5, :multiplier => 1 }],
[:dining_room, { :max_count => 3, :multiplier => 1 }],
[:kitchen, { :max_count => 3, :multiplier => 1 }],
[:full_bathroom, { :max_count => 10, :multiplier => 0.5 }],
[:half_bathroom, { :max_count => 10, :multiplier => 0.25 }],
[:heated_garage_berth, { :max_count => 5, :multiplier => 1 }],
[:other_room, { :max_count => 10, :multiplier => 1 }]
]
Instance Method Summary
collapse
Instance Method Details
#rooms ⇒ Object
19
20
21
22
23
24
25
26
|
# File 'lib/residence.rb', line 19
def rooms
return nil unless ROOMS.collect {|t| t.first}.all? { |r| send r.to_s.pluralize.to_sym }
ROOMS.map do |room|
room_name = room[0]
room_options = room[1]
send(room_name.to_s.pluralize.to_sym).to_i * room_options[:multiplier]
end.sum
end
|
#zip_code_name ⇒ Object
16
17
18
|
# File 'lib/residence.rb', line 16
def zip_code_name
zip_code ? zip_code.name : nil
end
|