Class: RareMap::Model

Inherits:
Object
  • Object
show all
Defined in:
lib/rare_map/model_builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(connection, table, group = 'default', db_name) ⇒ Model

Returns a new instance of Model.



103
104
105
106
# File 'lib/rare_map/model_builder.rb', line 103

def initialize(connection, table, group = 'default', db_name)
  @connection, @table, @group, @db_name = connection, table, group, db_name
  @relations = []
end

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.



101
102
103
# File 'lib/rare_map/model_builder.rb', line 101

def connection
  @connection
end

#db_nameObject (readonly)

Returns the value of attribute db_name.



101
102
103
# File 'lib/rare_map/model_builder.rb', line 101

def db_name
  @db_name
end

#groupObject (readonly)

Returns the value of attribute group.



101
102
103
# File 'lib/rare_map/model_builder.rb', line 101

def group
  @group
end

#relationsObject (readonly)

Returns the value of attribute relations.



101
102
103
# File 'lib/rare_map/model_builder.rb', line 101

def relations
  @relations
end

#tableObject (readonly)

Returns the value of attribute table.



101
102
103
# File 'lib/rare_map/model_builder.rb', line 101

def table
  @table
end

Instance Method Details

#classifyObject



112
113
114
# File 'lib/rare_map/model_builder.rb', line 112

def classify
  "#{table.name}".pluralize.classify
end

#group?Boolean

Returns:

  • (Boolean)


108
109
110
# File 'lib/rare_map/model_builder.rb', line 108

def group?
  group != 'default'
end