Class: Unitsml::Unitsdb::Prefixes

Inherits:
Object
  • Object
show all
Defined in:
lib/unitsml/unitsdb/prefixes.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#prefixesObject

Returns the value of attribute prefixes.



6
7
8
# File 'lib/unitsml/unitsdb/prefixes.rb', line 6

def prefixes
  @prefixes
end

Instance Method Details

#ascii_symbolsObject



12
13
14
15
16
17
18
19
# File 'lib/unitsml/unitsdb/prefixes.rb', line 12

def ascii_symbols
  prefixes.each_with_object([]) do |prefix, names_array|
    symbol = prefix.symbol.ascii
    next if symbol.empty?

    names_array << symbol
  end
end

#find_by_symbol_name(ascii_sym) ⇒ Object



8
9
10
# File 'lib/unitsml/unitsdb/prefixes.rb', line 8

def find_by_symbol_name(ascii_sym)
  prefixes.find { |prefix| prefix.symbol.ascii == ascii_sym }
end