Class: ShotgridApiRuby::Entity

Inherits:
T::Struct
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/shotgrid_api_ruby/entity.rb

Overview

Represent each entity returned by Shotgrid

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/shotgrid_api_ruby/entity.rb', line 20

def method_missing(name, *args, &block)
  if attributes.respond_to?(name)
    define_singleton_method(name) { attributes.public_send(name) }
    public_send(name)
  else
    super
  end
end

Instance Method Details

#respond_to_missing?(name, _private_methods = false) ⇒ Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/shotgrid_api_ruby/entity.rb', line 33

def respond_to_missing?(name, _private_methods = false)
  attributes.respond_to?(name) || super
end