Sha256: 24362c5615aae7d18739b9a3e8b4913c100a3c7b5d20cfb56b903cd38bdf0dd9
Contents?: true
Size: 1.62 KB
Versions: 2
Compression:
Stored size: 1.62 KB
Contents
require 'caracal/core/models/base_model' module Caracal module Core module Models # This class handles block options passed to tables via their data # collections. # class PageFlipModel < BaseModel #------------------------------------------------------------- # Configuration #------------------------------------------------------------- # accessors attr_reader :page_width attr_reader :page_margin_left attr_reader :page_margin_right # initialization def initialize(options={}, &block) super options, &block end #------------------------------------------------------------- # Public Methods #------------------------------------------------------------- #========== SETTERS =============================== # integers [:width, :margin_left, :margin_right].each do |m| define_method "#{ m }" do |value| instance_variable_set("@page_#{ m }", value.to_i) end end #=============== DATA ACCESSORS ======================= # .contents def contents @contents ||= [] end #=============== VALIDATION =========================== # .valid? def valid? contents.size > 0 end #-------------------------------------------------- # Private Instance Methods #-------------------------------------------------- private def option_keys [:width, :margin_left, :margin_right] end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
caracal_the_curve-1.4.6 | lib/caracal/core/models/page_flip_model.rb |
caracal_the_curve-1.4.5 | lib/caracal/core/models/page_flip_model.rb |