Class: Rumbly::Model::Klass

Inherits:
Object
  • Object
show all
Extended by:
Abstract
Defined in:
lib/rumbly/model/klass.rb

Overview

This is an abstract class that represents a single model class within an MVC application. Object mapper-specific implementations should subclass this class and implement the following methods: name, attributes, operations, abstract, and virtual.

Direct Known Subclasses

ActiveRecord::Klass

Constant Summary collapse

ATTRIBUTES =

Attributes and default values of a Klass

{
  name: '', attributes: [], operations: [], abstract: false, virtual: false
}

Instance Method Summary collapse

Methods included from Abstract

stub_required_methods

Instance Method Details

#<=>(other) ⇒ Object

Compares Klass objects using the name attribute.



32
33
34
# File 'lib/rumbly/model/klass.rb', line 32

def <=> (other)
  name <=> other.name
end

#abstract?Boolean

Simple question mark-style wrapper for the Klass#abstract attribute.

Returns:

  • (Boolean)


22
23
24
# File 'lib/rumbly/model/klass.rb', line 22

def abstract?
  abstract
end

#virtual?Boolean

Simple question mark-style wrapper for the Klass#virtual attribute.

Returns:

  • (Boolean)


27
28
29
# File 'lib/rumbly/model/klass.rb', line 27

def virtual?
  virtual
end