class Antex::TexBox
Loads and manages measures for TeX
boxes.
Public Instance Methods
load(filepath)
click to toggle source
Loads a YAML
file containing TeX
measures.
The expected input is a hash of named pt
lenghts. E.g.:
pt: 1.0pt wd: 5.0pt ht: 8.0pt dp: 2.0pt
@param filepath [String] the path of the YAML file to load @return [TexBox] returns self
after loading
# File lib/antex/tex_box.rb, line 20 def load(filepath) yaml_hash = YAML.safe_load File.read(filepath) units = yaml_hash.keys.map(&:to_sym) magnitudes = yaml_hash.values.map { |value| value.chomp('pt').to_f } @measures = units.zip(magnitudes).to_h @measures[:pt] ||= 1.0 @default_unit = :pt self end