class Ninja

Overview

class Fighter < ArangoModel::Document attribute _id : String attribute name : String attribute age : Int32 attribute weapons : String | Array(String) attribute deleted_at : Time attribute dead : Bool timestamps end

p Fighter.new exit 0

Defined in:

arango_model.cr

Constant Summary

ATTRIBUTES = {_id => String, name => String, age => Int32, weapons => String | Array(String), enemies => String | JSON::Any} of Nil => Nil

class Fighter < ArangoModel::Document attribute _id : String attribute name : String attribute age : Int32 attribute weapons : String | Array(String) attribute deleted_at : Time attribute dead : Bool timestamps end

p Fighter.new exit 0

PRIMARY = {name: _id, type: String}

class Fighter < ArangoModel::Document attribute _id : String attribute name : String attribute age : Int32 attribute weapons : String | Array(String) attribute deleted_at : Time attribute dead : Bool timestamps end

p Fighter.new exit 0

SETTINGS = {} of Nil => Nil

class Fighter < ArangoModel::Document attribute _id : String attribute name : String attribute age : Int32 attribute weapons : String | Array(String) attribute deleted_at : Time attribute dead : Bool timestamps end

p Fighter.new exit 0

Class Method Summary

Instance Method Summary

Instance methods inherited from class ArangoModel::Document

errors : Array(ArangoModel::Error) errors

Constructor methods inherited from class ArangoModel::Document

new(args : Hash(Symbol | String, ArangoModel::DatabaseTypes::Any | Nil))
new
new(**args : Object)
new

Class methods inherited from module ArangoModel::Collection

adapter adapter, db db

Class Method Detail

def self.adapter #

class Fighter < ArangoModel::Document attribute _id : String attribute name : String attribute age : Int32 attribute weapons : String | Array(String) attribute deleted_at : Time attribute dead : Bool timestamps end

p Fighter.new exit 0


def self.attributes(attributes = [] of String) #

keep a hash of the attributes to be used for mapping


def self.collection #

class Fighter < ArangoModel::Document attribute _id : String attribute name : String attribute age : Int32 attribute weapons : String | Array(String) attribute deleted_at : Time attribute dead : Bool timestamps end

p Fighter.new exit 0


def self.collection_name #

make accessible to outside classes


def self.db #

class Fighter < ArangoModel::Document attribute _id : String attribute name : String attribute age : Int32 attribute weapons : String | Array(String) attribute deleted_at : Time attribute dead : Bool timestamps end

p Fighter.new exit 0


def self.primary_name #

class Fighter < ArangoModel::Document attribute _id : String attribute name : String attribute age : Int32 attribute weapons : String | Array(String) attribute deleted_at : Time attribute dead : Bool timestamps end

p Fighter.new exit 0


Instance Method Detail

def _id : Union(String | Nil) #

Create the properties


def _id=(_id : Union(String)) #

Create the primary key


def _id=(_id : Union(String | Nil)) #

Create the properties


def age : Union(Int32 | Nil) #

class Fighter < ArangoModel::Document attribute _id : String attribute name : String attribute age : Int32 attribute weapons : String | Array(String) attribute deleted_at : Time attribute dead : Bool timestamps end

p Fighter.new exit 0


def age=(age : Union(Int32 | Nil)) #

class Fighter < ArangoModel::Document attribute _id : String attribute name : String attribute age : Int32 attribute weapons : String | Array(String) attribute deleted_at : Time attribute dead : Bool timestamps end

p Fighter.new exit 0


def attributes(attributes = {} of String => Type) #

keep a hash of the attributes to be used for mapping


def destroy #

Destroy will remove this from the database.


def enemies : Union(String | JSON::Any | Nil) #

class Fighter < ArangoModel::Document attribute _id : String attribute name : String attribute age : Int32 attribute weapons : String | Array(String) attribute deleted_at : Time attribute dead : Bool timestamps end

p Fighter.new exit 0


def enemies=(enemies : Union(String | JSON::Any | Nil)) #

class Fighter < ArangoModel::Document attribute _id : String attribute name : String attribute age : Int32 attribute weapons : String | Array(String) attribute deleted_at : Time attribute dead : Bool timestamps end

p Fighter.new exit 0


def id #

class Fighter < ArangoModel::Document attribute _id : String attribute name : String attribute age : Int32 attribute weapons : String | Array(String) attribute deleted_at : Time attribute dead : Bool timestamps end

p Fighter.new exit 0


def id=(value : String) #

class Fighter < ArangoModel::Document attribute _id : String attribute name : String attribute age : Int32 attribute weapons : String | Array(String) attribute deleted_at : Time attribute dead : Bool timestamps end

p Fighter.new exit 0


def inspect(io) #

class Fighter < ArangoModel::Document attribute _id : String attribute name : String attribute age : Int32 attribute weapons : String | Array(String) attribute deleted_at : Time attribute dead : Bool timestamps end

p Fighter.new exit 0


def name : Union(String | Nil) #

class Fighter < ArangoModel::Document attribute _id : String attribute name : String attribute age : Int32 attribute weapons : String | Array(String) attribute deleted_at : Time attribute dead : Bool timestamps end

p Fighter.new exit 0


def name=(name : Union(String | Nil)) #

class Fighter < ArangoModel::Document attribute _id : String attribute name : String attribute age : Int32 attribute weapons : String | Array(String) attribute deleted_at : Time attribute dead : Bool timestamps end

p Fighter.new exit 0


def params #

keep a hash of the params that will be passed to the adapter.


def save #

The save method will check to see if the primary exists yet. If it does it will call the update method, otherwise it will call the create method. This will update the timestamps apropriately.


def set_attributes(args : Hash(String | Symbol, Type)) #

class Fighter < ArangoModel::Document attribute _id : String attribute name : String attribute age : Int32 attribute weapons : String | Array(String) attribute deleted_at : Time attribute dead : Bool timestamps end

p Fighter.new exit 0


def set_attributes(**args) #

class Fighter < ArangoModel::Document attribute _id : String attribute name : String attribute age : Int32 attribute weapons : String | Array(String) attribute deleted_at : Time attribute dead : Bool timestamps end

p Fighter.new exit 0


def to_h #

class Fighter < ArangoModel::Document attribute _id : String attribute name : String attribute age : Int32 attribute weapons : String | Array(String) attribute deleted_at : Time attribute dead : Bool timestamps end

p Fighter.new exit 0


def to_json(json : JSON::Builder) #

class Fighter < ArangoModel::Document attribute _id : String attribute name : String attribute age : Int32 attribute weapons : String | Array(String) attribute deleted_at : Time attribute dead : Bool timestamps end

p Fighter.new exit 0


def weapons : Union(String | Array(String) | Nil) #

class Fighter < ArangoModel::Document attribute _id : String attribute name : String attribute age : Int32 attribute weapons : String | Array(String) attribute deleted_at : Time attribute dead : Bool timestamps end

p Fighter.new exit 0


def weapons=(weapons : Union(String | Array(String) | Nil)) #

class Fighter < ArangoModel::Document attribute _id : String attribute name : String attribute age : Int32 attribute weapons : String | Array(String) attribute deleted_at : Time attribute dead : Bool timestamps end

p Fighter.new exit 0