Module: Pulo

Defined in:
lib/pulo/version.rb,
lib/pulo/exceptions.rb,
lib/pulo/formatting.rb,
lib/pulo/frames/frame.rb,
lib/pulo/quantity/unit.rb,
lib/pulo/tables/tables.rb,
lib/pulo/material/water.rb,
lib/pulo/tables/density.rb,
lib/pulo/figure/figure2d.rb,
lib/pulo/figure/figure3d.rb,
lib/pulo/frames/frame_row.rb,
lib/pulo/quantity_checker.rb,
lib/pulo/frames/frame_cell.rb,
lib/pulo/quantity/quantity.rb,
lib/pulo/quantity/quantity.rb,
lib/pulo/machine/steam/if97.rb,
lib/pulo/quantity/dimension.rb,
lib/pulo/frames/frame_column.rb,
lib/pulo/machine/steam/boiler.rb,
lib/pulo/machine/steam/header.rb,
lib/pulo/tables/speed_of_sound.rb,
lib/pulo/tables/yield_strength.rb,
lib/pulo/tables/specific_energy.rb,
lib/pulo/machine/hydraulics/pipe.rb,
lib/pulo/machine/steam/deaerator.rb,
lib/pulo/tables/tensile_strength.rb,
lib/pulo/machine/steam/water_steam.rb,
lib/pulo/quantity/quantity_builder.rb,
lib/pulo/tables/melting_temperature.rb,
lib/pulo/machine/steam/desuperheater.rb,
lib/pulo/machine/steam/steam_process.rb,
lib/pulo/machine/steam/steam_turbine.rb,
lib/pulo/machine/steam/boiler_deaerator.rb,
lib/pulo/quantity/quantity_definitions/basic.rb,
lib/pulo/quantity/quantity_definitions/value.rb,
lib/pulo/machine/mechanics/moments_of_inertia.rb,
lib/pulo/quantity/quantity_definitions/energy.rb,
lib/pulo/quantity/quantity_definitions/fluids.rb,
lib/pulo/quantity/quantity_definitions/electric.rb,
lib/pulo/quantity/quantity_definitions/rotation.rb,
lib/pulo/quantity/quantity_groups/quantity_groups.rb,
lib/pulo/quantity/quantity_definitions/area_volume.rb,
lib/pulo/quantity/quantity_definitions/force_power.rb,
lib/pulo/quantity/quantity_definitions/velocity_acc_flow.rb

Defined Under Namespace

Modules: Densities, Figure2D, Figure3D, MeltingTemperatures, QuantityGroups, Quantity_Checker, SpecificEnergies, SpeedOfSound, Steam, Tables, TensileStrengths, YieldStrengths Classes: Angle, AngularVelocity, Circle, Cube, Cuboid, Cylinder, Dimension, Frame, FrameCell, FrameColumn, FrameRow, Frequency, MomentOfInertia, NonSI_Unit, NumberToDelimitedConverter, NumberToRoundedConverter, PipeTypes, Pipeline, Pressure, Prism, QuantitiesException, Quantity, QuantityBuilder, Rectangle, SI_Unit, Sphere, Square, Temperature, Trapezoid, TrapezoidalPrism, Triangle, Unit, Water

Constant Summary collapse

VERSION =
'0.1.3'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.precisionObject

Returns the value of attribute precision.



6
7
8
# File 'lib/pulo/quantity/quantity.rb', line 6

def precision
  @precision
end

.significant_figuresObject

Returns the value of attribute significant_figures.



7
8
9
# File 'lib/pulo/quantity/quantity.rb', line 7

def significant_figures
  @significant_figures
end

.supress_quantity_namesObject

Returns the value of attribute supress_quantity_names.



8
9
10
# File 'lib/pulo/quantity/quantity.rb', line 8

def supress_quantity_names
  @supress_quantity_names
end

Class Method Details

.helpObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/pulo/quantity/quantity.rb', line 12

def help
  @quantities.each do |dim|

    dim[1].each do |quan|
      names=quan.quantity_name
      if quan.synonyms.length>0
        names += ', ' + quan.synonyms.join(', ')
      end

      puts names
      puts '---------------------------------------------------------------------------------------'
      puts '[' + dim[0].to_s + ']'
      puts quan.units_sorted
      puts ''
    end
  end
end

.quantitiesObject

hash with dimension_spec as the key



10
# File 'lib/pulo/quantity/quantity.rb', line 10

def quantities; @quantities||={};end

.stats_format(stats) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/pulo/formatting.rb', line 6

def stats_format stats
  ret=''
  stats.each do |stat|
    if stat[0]==:number
      ret+='Count: ' + stat[1].to_s + "\n"
    else
      ret+=stat[0].to_s.capitalize + ': ' + stat[1].to_s + "\n"
    end
  end
  ret
end

.super_digit(val) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/pulo/formatting.rb', line 18

def super_digit(val)
  val.to_s.chars.inject('') do |res, chr|
    res+= case chr
            when '.'
              "\u207B".encode('utf-8')
            when '-'
              "\u207B".encode('utf-8')
            when '1'
              "\u00B9".encode('utf-8')
            when '2'
              "\u00B2".encode('utf-8')
            when '3'
              "\u00B3".encode('utf-8')
            when '0'
              "\u2070".encode('utf-8')
            when '4'
              "\u2074".encode('utf-8')
            when '5'
              "\u2075".encode('utf-8')
            when '6'
              "\u2076".encode('utf-8')
            when '7'
              "\u2077".encode('utf-8')
            when '8'
              "\u2078".encode('utf-8')
            when '9'
              "\u2079".encode('utf-8')
            else
              ''
          end
  end
end