Class: Dbee::Providers::ActiveRecordProvider
- Inherits:
-
Object
- Object
- Dbee::Providers::ActiveRecordProvider
- Defined in:
- lib/dbee/providers/active_record_provider.rb,
lib/dbee/providers/active_record_provider/maker.rb,
lib/dbee/providers/active_record_provider/version.rb,
lib/dbee/providers/active_record_provider/makers/order.rb,
lib/dbee/providers/active_record_provider/makers/where.rb,
lib/dbee/providers/active_record_provider/makers/select.rb,
lib/dbee/providers/active_record_provider/safe_alias_maker.rb,
lib/dbee/providers/active_record_provider/makers/constraint.rb,
lib/dbee/providers/active_record_provider/expression_builder.rb,
lib/dbee/providers/active_record_provider/obfuscated_alias_maker.rb
Overview
Provider which leverages ActiveRecord and Arel for generating SQL.
Defined Under Namespace
Modules: Makers Classes: ExpressionBuilder, Maker, ObfuscatedAliasMaker, SafeAliasMaker
Constant Summary collapse
- VERSION =
'2.3.0'
Instance Attribute Summary collapse
-
#column_alias_maker ⇒ Object
readonly
Returns the value of attribute column_alias_maker.
-
#readable ⇒ Object
readonly
Returns the value of attribute readable.
-
#table_alias_maker ⇒ Object
readonly
Returns the value of attribute table_alias_maker.
Instance Method Summary collapse
-
#initialize(readable: true, table_prefix: DEFAULT_TABLE_PREFIX, column_prefix: DEFAULT_COLUMN_PREFIX) ⇒ ActiveRecordProvider
constructor
A new instance of ActiveRecordProvider.
- #sql(schema, query) ⇒ Object
Constructor Details
#initialize(readable: true, table_prefix: DEFAULT_TABLE_PREFIX, column_prefix: DEFAULT_COLUMN_PREFIX) ⇒ ActiveRecordProvider
Returns a new instance of ActiveRecordProvider.
28 29 30 31 32 33 34 35 36 |
# File 'lib/dbee/providers/active_record_provider.rb', line 28 def initialize( readable: true, table_prefix: DEFAULT_TABLE_PREFIX, column_prefix: DEFAULT_COLUMN_PREFIX ) @readable = readable @table_alias_maker = alias_maker(table_prefix) @column_alias_maker = alias_maker(column_prefix) end |
Instance Attribute Details
#column_alias_maker ⇒ Object (readonly)
Returns the value of attribute column_alias_maker.
26 27 28 |
# File 'lib/dbee/providers/active_record_provider.rb', line 26 def column_alias_maker @column_alias_maker end |
#readable ⇒ Object (readonly)
Returns the value of attribute readable.
26 27 28 |
# File 'lib/dbee/providers/active_record_provider.rb', line 26 def readable @readable end |
#table_alias_maker ⇒ Object (readonly)
Returns the value of attribute table_alias_maker.
26 27 28 |
# File 'lib/dbee/providers/active_record_provider.rb', line 26 def table_alias_maker @table_alias_maker end |
Instance Method Details
#sql(schema, query) ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/dbee/providers/active_record_provider.rb', line 38 def sql(schema, query) ExpressionBuilder.new( schema, table_alias_maker, column_alias_maker ).to_sql(query) end |