Class: Inkmake::InkscapeResolution

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(width, height, unit = "uu") ⇒ InkscapeResolution

Returns a new instance of InkscapeResolution.



101
102
103
104
# File 'lib/inkmake.rb', line 101

def initialize(width, height, unit="uu")
  @width = width.kind_of?(InkscapeUnit) ? width : InkscapeUnit.new(width, unit)
  @height = height.kind_of?(InkscapeUnit) ? height : InkscapeUnit.new(height, unit)
end

Instance Attribute Details

#heightObject (readonly)

Returns the value of attribute height.



99
100
101
# File 'lib/inkmake.rb', line 99

def height
  @height
end

#widthObject (readonly)

Returns the value of attribute width.



99
100
101
# File 'lib/inkmake.rb', line 99

def width
  @width
end

Instance Method Details

#scale(f) ⇒ Object



106
107
108
# File 'lib/inkmake.rb', line 106

def scale(f)
  InkscapeResolution.new(@width.scale(f), @height.scale(f))
end

#to_sObject



110
111
112
# File 'lib/inkmake.rb', line 110

def to_s
  "#{@width.to_s}x#{@height.to_s}"
end