Sha256: 25f2124c8d6949c2a6d6629112bcf982cbc72a11bfe5dde1dc6ef2b66b884444

Contents?: true

Size: 1.31 KB

Versions: 37

Compression:

Stored size: 1.31 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

37 entries across 37 versions & 2 rubygems

Version Path
caracal_the_curve-1.4.6 lib/caracal/core/models/base_model.rb
caracal_the_curve-1.4.5 lib/caracal/core/models/base_model.rb
caracal_the_curve-1.4.4 lib/caracal/core/models/base_model.rb
caracal_the_curve-1.4.3 lib/caracal/core/models/base_model.rb
caracal_the_curve-1.4.2 lib/caracal/core/models/base_model.rb
caracal_the_curve-1.4.1 lib/caracal/core/models/base_model.rb
caracal-1.4.1 lib/caracal/core/models/base_model.rb
caracal-1.4.0 lib/caracal/core/models/base_model.rb
caracal-1.3.0 lib/caracal/core/models/base_model.rb
caracal-1.2.0 lib/caracal/core/models/base_model.rb
caracal-1.1.2 lib/caracal/core/models/base_model.rb
caracal-1.1.1 lib/caracal/core/models/base_model.rb
caracal-1.1.0 lib/caracal/core/models/base_model.rb
caracal-1.0.13 lib/caracal/core/models/base_model.rb
caracal-1.0.12 lib/caracal/core/models/base_model.rb
caracal-1.0.11 lib/caracal/core/models/base_model.rb
caracal-1.0.10 lib/caracal/core/models/base_model.rb
caracal-1.0.9 lib/caracal/core/models/base_model.rb
caracal-1.0.8 lib/caracal/core/models/base_model.rb
caracal-1.0.7 lib/caracal/core/models/base_model.rb