Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/clockwork_comic_pdf/to_points.rb

Overview

adds point conversion function for hash values

Instance Method Summary collapse

Instance Method Details

#to_pointsObject



5
6
7
8
9
10
11
12
# File 'lib/clockwork_comic_pdf/to_points.rb', line 5

def to_points
  if size == 2 && self[:val] && self[:type]
    return self[:val].to_f.send(self[:type])
  end
  puts self
  fail ClockworkComicPDF::UndefinedKeyError,
       'measurement must contain only :val and :type'
end