Sha256: d019d65407efe3da7fb34e58cc9fab95d644effb78bfb0a61e85b55b4c353da2

Contents?: true

Size: 546 Bytes

Versions: 2

Compression:

Stored size: 546 Bytes

Contents

# frozen_string_literal: true

module ShotgunApiRuby
  # Represent each entity returned by Shotgun
  Entity =
    Struct.new(:type, :attributes, :relationships, :id, :links) do
      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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
shotgun_api_ruby-0.1.1 lib/shotgun_api_ruby/entity.rb
shotgun_api_ruby-0.1.0.1 lib/shotgun_api_ruby/entity.rb