Sha256: a28567c0ca99f9253f835731c1331a488a3169fb33479840c39f894d46a9adb4

Contents?: true

Size: 703 Bytes

Versions: 1

Compression:

Stored size: 703 Bytes

Contents

module Eulim
  module Chemical
    module Reactors
      # This is the base class for the diff kinds of reactors
      class Reactor
        attr_accessor :system, :volume, :input, :output, :conversion

        def initialize(args = {})
          @volume = volume_if_valid(args[:volume]) if args[:volume]
          @system = args[:system] || :open
        end

        private

        def volume_if_valid(vol)
          begin
            vol = Unitwise(vol)
          rescue
            raise ArgumentError, 'Invalid volume argument'
          end
          return vol if vol.composition.to_h == { 'L' => 3 }
          raise ArgumentError, 'Invalid volume unit'
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
eulim-0.0.12 lib/eulim/chemical/reactors/reactor.rb