Class: Clevic::SequelAdaptor
Instance Method Summary collapse
- #attribute_list(attribute, attribute_value, by_description, by_frequency, find_options, &block) ⇒ Object
- #count(*args) ⇒ Object
- #find(*args) ⇒ Object
-
#initialize(entity_class) ⇒ SequelAdaptor
constructor
A new instance of SequelAdaptor.
- #quoted_false ⇒ Object
- #quoted_true ⇒ Object
Constructor Details
#initialize(entity_class) ⇒ SequelAdaptor
Returns a new instance of SequelAdaptor.
9 10 11 12 |
# File 'lib/clevic/sequel_ar_adapter.rb', line 9 def initialize( entity_class ) @entity_class = entity_class @entity_class.plugin :ar_methods end |
Instance Method Details
#attribute_list(attribute, attribute_value, by_description, by_frequency, find_options, &block) ⇒ Object
30 31 32 33 34 |
# File 'lib/clevic/sequel_ar_adapter.rb', line 30 def attribute_list( attribute, attribute_value, by_description, by_frequency, , &block ) lister = AttributeList.new( @entity_class, attribute, attribute_value, ) ds = lister.dataset( by_description, by_frequency ) ds.map( &block ) end |
#count(*args) ⇒ Object
22 23 24 |
# File 'lib/clevic/sequel_ar_adapter.rb', line 22 def count( *args ) @entity_class.count_ar( *args ) end |
#find(*args) ⇒ Object
26 27 28 |
# File 'lib/clevic/sequel_ar_adapter.rb', line 26 def find( *args ) @entity_class.find_ar( *args ) end |
#quoted_false ⇒ Object
14 15 16 |
# File 'lib/clevic/sequel_ar_adapter.rb', line 14 def quoted_false @entity_class.dataset.boolean_constant_sql( false ) end |
#quoted_true ⇒ Object
18 19 20 |
# File 'lib/clevic/sequel_ar_adapter.rb', line 18 def quoted_true @entity_class.dataset.boolean_constant_sql( true ) end |