Sha256: 4e0c84e266ab78533457da907fef75913b2c885a38386d454570a33f7d194127

Contents?: true

Size: 1.32 KB

Versions: 1

Compression:

Stored size: 1.32 KB

Contents

module Caracal
  module Core
    module Models
      
      # This class encapsulates the logic needed for functions that 
      # do not store or manipulate data.
      #
      class BaseModel
        
        #-------------------------------------------------------------
        # Configuration
        #-------------------------------------------------------------
    
        # initialization
        def initialize(options = {}, &block)
          options.keep_if { |k,v| option_keys.include? k }
          options.each do |(key, value)|
            send(key, value)
          end
          
          if block_given?
            (block.arity < 1) ? instance_eval(&block) : block[self]
          end
        end
        
        
        #-------------------------------------------------------------
        # Public Instance Methods
        #-------------------------------------------------------------
    
        #=============== VALIDATION ===========================
        
        def valid?
          true
        end
        
        
        #-------------------------------------------------------------
        # Private Instance Methods
        #-------------------------------------------------------------
        private
        
        def option_keys
          []
        end
        
      end
      
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
caracal-0.1.1 lib/caracal/core/models/base_model.rb