Module: Ronin::Model::HasName

Included in:
Author, OS
Defined in:
lib/ronin/model/has_name.rb

Overview

Adds a name property to a model.

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object

Adds the name property and ClassMethods to the model.

Parameters:

  • base (Class)

    The model.


36
37
38
39
40
41
42
43
44
# File 'lib/ronin/model/has_name.rb', line 36

def self.included(base)
  base.send :include, Model, InstanceMethods
  base.send :extend, ClassMethods

  base.module_eval do
    # The name of the model
    property :name, String, :required => true, :index => true
  end
end