mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-25 08:09:38 +02:00
* Add backend for property account details
* Rubocop updates
* Add property form with details
* Revert "Rubocop updates"
This reverts commit 05b0b8f3a4
.
* Bump brakeman to latest version
* Add overview section to property view
* Lint fixes
20 lines
362 B
Ruby
20 lines
362 B
Ruby
class Measurement
|
|
include ActiveModel::Validations
|
|
|
|
attr_reader :value, :unit
|
|
|
|
VALID_UNITS = %w[sqft sqm]
|
|
|
|
validates :unit, inclusion: { in: VALID_UNITS }
|
|
validates :value, presence: true
|
|
|
|
def initialize(value, unit)
|
|
@value = value.to_f
|
|
@unit = unit.to_s.downcase.strip
|
|
validate!
|
|
end
|
|
|
|
def to_s
|
|
"#{@value.to_i} #{@unit}"
|
|
end
|
|
end
|