Sha256: 2b92b5bde0611350905b032f24e95f9dfd1c2390b887e643ff67a20700d62841
Contents?: true
Size: 786 Bytes
Versions: 1
Compression:
Stored size: 786 Bytes
Contents
require 'ruby-units' # Agrupa los diferentes tipos de grasas que pueden haber en una etiqueta class Grasas include Comparable attr_accessor :total, :saturadas, :monoinsaturadas, :polinsaturadas def initialize(total, saturadas, monoinsaturadas = nil, polinsaturadas = nil) @total = Unit.new(total).convert_to('g') @saturadas = Unit.new(saturadas).convert_to('g') @monoinsaturadas = Unit.new(monoinsaturadas).convert_to('g') unless monoinsaturadas.nil? @polinsaturadas = Unit.new(polinsaturadas).convert_to('g') unless polinsaturadas.nil? end def <=>(other) [total, saturadas, monoinsaturadas, polinsaturadas] <=> [other.total, other.saturadas, other.monoinsaturadas, other.polinsaturadas] end def to_s "#{total}" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gematdd-dibad-0.1.1 | lib/gematdd/etiqueta/grasas.rb |