Class: Rodauth::TemplateInspector::BindingContext::MockDatabase
- Inherits:
-
Object
- Object
- Rodauth::TemplateInspector::BindingContext::MockDatabase
- Defined in:
- lib/rodauth/template_inspector.rb
Overview
Mock Sequel database for ERB templates
Instance Attribute Summary collapse
-
#database_type ⇒ Object
readonly
Returns the value of attribute database_type.
Instance Method Summary collapse
-
#initialize(db_type) ⇒ MockDatabase
constructor
A new instance of MockDatabase.
-
#method_missing(_method, *_args) ⇒ Object
Stub other methods that might be called in templates.
- #respond_to_missing?(_method, _include_private = false) ⇒ Boolean
- #supports_partial_indexes? ⇒ Boolean
Constructor Details
#initialize(db_type) ⇒ MockDatabase
Returns a new instance of MockDatabase.
113 114 115 |
# File 'lib/rodauth/template_inspector.rb', line 113 def initialize(db_type) @database_type = db_type end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(_method, *_args) ⇒ Object
Stub other methods that might be called in templates
123 124 125 126 |
# File 'lib/rodauth/template_inspector.rb', line 123 def method_missing(_method, *_args) # Return a safe default for unknown methods nil end |
Instance Attribute Details
#database_type ⇒ Object (readonly)
Returns the value of attribute database_type.
111 112 113 |
# File 'lib/rodauth/template_inspector.rb', line 111 def database_type @database_type end |
Instance Method Details
#respond_to_missing?(_method, _include_private = false) ⇒ Boolean
128 129 130 |
# File 'lib/rodauth/template_inspector.rb', line 128 def respond_to_missing?(_method, _include_private = false) true end |
#supports_partial_indexes? ⇒ Boolean
117 118 119 120 |
# File 'lib/rodauth/template_inspector.rb', line 117 def supports_partial_indexes? # PostgreSQL and SQLite support partial indexes %i[postgres sqlite].include?(@database_type) end |