Top Level Namespace
Defined Under Namespace
Modules: TeachingPrintables
Classes: SVGComponents, SVGCreator
Instance Method Summary
collapse
Instance Method Details
#ind2sub(siz, ind) ⇒ Object
2
3
4
5
6
7
8
|
# 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) ⇒ Object
5
6
7
|
# 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) ⇒ Object
1
2
3
|
# File 'lib/teaching_printables/svg/svg_helpers.rb', line 1
def svg_width(svg)
/(?<=width=\")\d+(?=\"\s)/.match(svg)[0].to_i
end
|