Class: Dart::Reflection::SequelTable::Resolver
- Inherits:
-
AbstractResolver
- Object
- AbstractResolver
- Dart::Reflection::SequelTable::Resolver
- Defined in:
- lib/dart/reflection/sequel_table/resolver.rb
Defined Under Namespace
Classes: TheSchema
Instance Method Summary collapse
-
#association_for(ass_name) ⇒ Association
Returns the association with the given ass_name or nil if one does not exist.
- #build_from_association(association) ⇒ Object
-
#column_for(col_name) ⇒ String
Returns the column with the given col_name or nil if one does not exist.
-
#initialize(table_name) ⇒ Resolver
constructor
A new instance of Resolver.
- #table_name ⇒ Object
Constructor Details
Instance Method Details
#association_for(ass_name) ⇒ Association
Returns the association with the given ass_name or nil if one does not exist
22 23 24 25 26 |
# File 'lib/dart/reflection/sequel_table/resolver.rb', line 22 def association_for(ass_name) ass = relation.all_associations.detect { |ass| ass.name == ass_name } ass.scope = {} # no scope can be determined by SQL reflection ass end |
#build_from_association(association) ⇒ Object
14 15 16 |
# File 'lib/dart/reflection/sequel_table/resolver.rb', line 14 def build_from_association(association) self.class.new(association.associated_table) end |
#column_for(col_name) ⇒ String
Returns the column with the given col_name or nil if one does not exist
31 32 33 |
# File 'lib/dart/reflection/sequel_table/resolver.rb', line 31 def column_for(col_name) relation.column_names.detect { |col| col == col_name } end |
#table_name ⇒ Object
35 36 37 |
# File 'lib/dart/reflection/sequel_table/resolver.rb', line 35 def table_name @table_name end |