lib/unitwise/unit.rb in unitwise-0.9.1 vs lib/unitwise/unit.rb in unitwise-0.10.0
- old
+ new
@@ -100,9 +100,16 @@
def to_s(mode = mode)
expression(mode || self.mode)
end
+ def aliases
+ [:names, :primary_code, :secondary_code, :symbol].map do |mode|
+ to_s(mode)
+ end.uniq
+ end
+ memoize :aliases
+
def mode
terms
@mode || :primary_code
end