Class: Unitwise::Standard::Prefix

Inherits:
Base
  • Object
show all
Defined in:
lib/unitwise/standard/prefix.rb

Instance Attribute Summary

Attributes inherited from Base

#attributes

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

all, hash, #initialize, local_key, #names, path, #primary_code, read, #secondary_code, #symbol, write

Methods included from Extras

#hash_to_markup

Constructor Details

This class inherits a constructor from Unitwise::Standard::Base

Class Method Details

.remote_keyObject



4
5
6
# File 'lib/unitwise/standard/prefix.rb', line 4

def self.remote_key
  "prefix"
end

Instance Method Details

#scaleObject



8
9
10
11
12
# File 'lib/unitwise/standard/prefix.rb', line 8

def scale
  Unitwise::Number.coefficify(
    attributes.fetch('value').attributes.fetch('value')
  )
end

#to_hashObject



14
15
16
# File 'lib/unitwise/standard/prefix.rb', line 14

def to_hash
  super().merge(:scalar => scale)
end