Module: Neo4j::Shared::TypecastedAttributes::ClassMethods

Defined in:
lib/neo4j/shared/typecasted_attributes.rb

Instance Method Summary collapse

Instance Method Details

#inspectString

Returns the class name plus its attribute names and types

Examples:

Inspect the model's definition.

Person.inspect

Returns:

  • (String)

    Human-readable presentation of the attributes


80
81
82
83
84
# File 'lib/neo4j/shared/typecasted_attributes.rb', line 80

def inspect
  inspected_attributes = attribute_names.sort.map { |name| "#{name}: #{_attribute_type(name)}" }
  attributes_list = "(#{inspected_attributes.join(', ')})" unless inspected_attributes.empty?
  "#{name}#{attributes_list}"
end

#typecast_attribute(typecaster, value) ⇒ Object


93
94
95
# File 'lib/neo4j/shared/typecasted_attributes.rb', line 93

def typecast_attribute(typecaster, value)
  Neo4j::Shared::TypeConverters.typecast_attribute(typecaster, value)
end