Class: RareMap::Model
- Inherits:
-
Object
- Object
- RareMap::Model
- Defined in:
- lib/rare_map/model_builder.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#db_name ⇒ Object
readonly
Returns the value of attribute db_name.
-
#group ⇒ Object
readonly
Returns the value of attribute group.
-
#relations ⇒ Object
readonly
Returns the value of attribute relations.
-
#table ⇒ Object
readonly
Returns the value of attribute table.
Instance Method Summary collapse
- #classify ⇒ Object
- #group? ⇒ Boolean
-
#initialize(connection, table, group = 'default', db_name) ⇒ Model
constructor
A new instance of Model.
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
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
101 102 103 |
# File 'lib/rare_map/model_builder.rb', line 101 def connection @connection end |
#db_name ⇒ Object (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 |
#group ⇒ Object (readonly)
Returns the value of attribute group.
101 102 103 |
# File 'lib/rare_map/model_builder.rb', line 101 def group @group end |
#relations ⇒ Object (readonly)
Returns the value of attribute relations.
101 102 103 |
# File 'lib/rare_map/model_builder.rb', line 101 def relations @relations end |
#table ⇒ Object (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
#classify ⇒ Object
112 113 114 |
# File 'lib/rare_map/model_builder.rb', line 112 def classify "#{table.name}".pluralize.classify end |
#group? ⇒ Boolean
108 109 110 |
# File 'lib/rare_map/model_builder.rb', line 108 def group? group != 'default' end |