module Pulo

Constants

VERSION

Attributes

precision[RW]
significant_figures[RW]
supress_quantity_names[RW]

Public Class Methods

help() click to toggle source
# 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
quantities() click to toggle source
# File lib/pulo/quantity/quantity.rb, line 10
def quantities; @quantities||={};end
stats_format(stats) click to toggle source
# 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) click to toggle source
# 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