Class: EideticRML::Styles::Style

Inherits:
Object
  • Object
show all
Includes:
EideticRML::Support
Defined in:
lib/erml_styles.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from EideticRML::Support

#from_units, parse_measurement, parse_measurement_pts, #to_units

Constructor Details

#initialize(styles, attrs = {}) ⇒ Style

Returns a new instance of Style.



41
42
43
44
# File 'lib/erml_styles.rb', line 41

def initialize(styles, attrs={})
  @styles = styles
  attrs.each { |key, value| self.send(key, value) }
end

Class Method Details

.for_name(name) ⇒ Object



63
64
65
# File 'lib/erml_styles.rb', line 63

def self.for_name(name)
  @@klasses[name] unless @@klasses.nil?
end

.register(name, klass) ⇒ Object



59
60
61
# File 'lib/erml_styles.rb', line 59

def self.register(name, klass)
  (@@klasses ||= {})[name] = klass
end

Instance Method Details

#from_points(value, units) ⇒ Object



50
51
52
# File 'lib/erml_styles.rb', line 50

def from_points(value, units)
  value.to_f / EideticPDF::UNIT_CONVERSION[units]
end

#id(value = nil) ⇒ Object



54
55
56
57
# File 'lib/erml_styles.rb', line 54

def id(value=nil)
  return @id if value.nil?
  @id = value.to_s
end

#initialize_copy(other) ⇒ Object



46
47
48
# File 'lib/erml_styles.rb', line 46

def initialize_copy(other)
  @id = nil
end