class Object

Public Instance Methods

ind2sub(siz,ind) click to toggle source
# File lib/teaching_printables/utilities.rb, line 2
def ind2sub(siz,ind)
  if !siz || !ind || !siz.is_a?(Array) || siz.count!=2 || !ind.is_a?(Integer) || ind >= siz[0]*siz[1]
    raise ArgumentError
  end

  return [ind%siz[0],ind/siz[0]]
end
svg_height(svg) click to toggle source
# File lib/teaching_printables/svg/svg_helpers.rb, line 5
def svg_height(svg)
  /(?<=height=\")\d+(?=\"\s)/.match(svg)[0].to_i
end
svg_width(svg) click to toggle source
# File lib/teaching_printables/svg/svg_helpers.rb, line 1
def svg_width(svg)
  /(?<=width=\")\d+(?=\"\s)/.match(svg)[0].to_i
end