Method: UnitMeasurements::Unit#with
- Defined in:
- lib/unit_measurements/unit.rb
#with(name: nil, value: nil, aliases: nil, system: nil, unit_group: nil) ⇒ Unit
Returns a new Unit
instance with specified attributes.
86 87 88 89 90 91 92 93 94 |
# File 'lib/unit_measurements/unit.rb', line 86 def with(name: nil, value: nil, aliases: nil, system: nil, unit_group: nil) self.class.new( (name || self.name), value: (value || self.value), aliases: (aliases || self.aliases), system: (system || self.system), unit_group: (unit_group || self.unit_group) ) end |