Module: EasyTalk::Model::InstanceMethods

Includes:
SchemaBase::InstanceMethods
Defined in:
lib/easy_talk/model.rb

Overview

Instance methods mixed into models that include EasyTalk::Model

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class EasyTalk::SchemaBase::InstanceMethods

Instance Method Details

#==(other) ⇒ Object Originally defined in module SchemaBase::InstanceMethods

#as_json(_options = {}) ⇒ Object Originally defined in module SchemaBase::InstanceMethods

#initialize(attributes = {}) ⇒ Object



59
60
61
62
63
64
65
66
# File 'lib/easy_talk/model.rb', line 59

def initialize(attributes = {})
  @additional_properties = {}
  provided_keys = attributes.keys.to_set(&:to_sym)

  super # Perform initial mass assignment via ActiveModel::API

  initialize_schema_properties(provided_keys)
end

#respond_to_missing?(method_name, include_private = false) ⇒ Boolean Originally defined in module SchemaBase::InstanceMethods

Returns:

  • (Boolean)

#to_hObject Originally defined in module SchemaBase::InstanceMethods

#to_hashObject Originally defined in module SchemaBase::InstanceMethods

#to_json_schemaHash

Returns a Hash representing the schema in a format compatible with RubyLLM. Delegates to the class method. Required for RubyLLM's with_schema method.

Returns:

  • (Hash)

    The RubyLLM-compatible schema representation



72
73
74
# File 'lib/easy_talk/model.rb', line 72

def to_json_schema
  self.class.to_json_schema
end