Sha256: 027428e00716d1d22f25c51cec598158daa111dfc47d501fd33c8a82d29f8377

Contents?: true

Size: 447 Bytes

Versions: 7

Compression:

Stored size: 447 Bytes

Contents

# -*- encoding: utf-8 -*-
# -*- frozen_string_literal: true -*-
# -*- warn_indent: true -*-

module UnitMeasurements
  class UnitGroup
    include UnitMethods

    attr_reader :units, :systems

    def initialize(units, systems)
      @units = units.map { |unit| unit.with(unit_group: self) }
      @systems = systems
    end

    def system_for(system_name)
      @systems.find { |system| system.name.to_s == system_name.to_s }
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
unit_measurements-3.8.0 lib/unit_measurements/unit_group.rb
unit_measurements-3.7.0 lib/unit_measurements/unit_group.rb
unit_measurements-3.6.0 lib/unit_measurements/unit_group.rb
unit_measurements-3.5.0 lib/unit_measurements/unit_group.rb
unit_measurements-3.4.1 lib/unit_measurements/unit_group.rb
unit_measurements-3.3.0 lib/unit_measurements/unit_group.rb
unit_measurements-3.4.0 lib/unit_measurements/unit_group.rb