class Caracal::Core::Models::PageSizeModel
This class handles block options passed to the page size method.
Attributes
page_height[R]
page_orientation[R]
page_width[R]
accessors
Public Class Methods
new(options={}, &block)
click to toggle source
initialization
Calls superclass method
Caracal::Core::Models::BaseModel::new
# File lib/caracal/core/models/page_size_model.rb, line 28 def initialize(options={}, &block) @page_width = DEFAULT_PAGE_WIDTH @page_height = DEFAULT_PAGE_HEIGHT @page_orientation = DEFAULT_PAGE_ORIENTATION super options, &block end
Public Instance Methods
height(value)
click to toggle source
orientation(value)
click to toggle source
# File lib/caracal/core/models/page_size_model.rb, line 47 def orientation(value) allowed = ['landscape','portrait'] given = value.to_s.downcase @page_orientation = allowed.include?(given) ? given : 'portrait' end
valid?()
click to toggle source
width(value)
click to toggle source
# File lib/caracal/core/models/page_size_model.rb, line 53 def width(value) @page_width = value.to_i end
Private Instance Methods
option_keys()
click to toggle source
# File lib/caracal/core/models/page_size_model.rb, line 71 def option_keys [:width, :height, :orientation] end