Class: Mousevc::Model

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

Overview

The base model class for a Mousevc application. Provides access to basic functionality for validating input before modifying data via it's @validation attribute, an instance of the Mousevc::Validation class.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Model

Creates a new Mousevc::Model instance

Parameters:

  • options (Hash) (defaults to: {})

    optionally accepts the following keys:

    • :validation => [Mousevc::Router] an instance of the Mousevc::Validation class


24
25
26
27
# File 'lib/mousevc/model.rb', line 24

def initialize(options={})
	@validation = options[:validation] ? options[:validation] : Validation.new
	clear
end

Instance Attribute Details

#validationMousevc::Validation (readonly)

Returns a reference to the model's validation instance

Returns:


16
17
18
# File 'lib/mousevc/model.rb', line 16

def validation
  @validation
end

Instance Method Details

#clearObject

Overridable empty method for clearing data in the model subclass


32
33
# File 'lib/mousevc/model.rb', line 32

def clear
end