Class: Rodauth::TemplateInspector::BindingContext::MockDatabase

Inherits:
Object
  • Object
show all
Defined in:
lib/rodauth/template_inspector.rb

Overview

Mock Sequel database for ERB templates

Instance Attribute Summary collapse

Instance Method Summary collapse

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_typeObject (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

Returns:

  • (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

Returns:

  • (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