Sha256: b05f8c83e7c78a406e2245da8098016ca4c02f822a89ec7e13c8690f52bbb99f

Contents?: true

Size: 574 Bytes

Versions: 2

Compression:

Stored size: 574 Bytes

Contents

# frozen_string_literal: true

module ShotgunApiRuby
  Entity =
    Struct.new(:type, :attributes, :relationships, :id, :links) do
      def method_missing(name, *args, &block)
        if attributes.respond_to?(name)
          define_singleton_method(name) do
            attributes.public_send(name)
          end
          public_send(name)
        else
          super
        end
      end

      def respond_to_missing?(name, _private_methods = false) # rubocop:disable Style/OptionalBooleanParameter
        attributes.respond_to?(name) || super
      end
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
shotgun_api_ruby-0.0.5 lib/shotgun_api_ruby/entity.rb
shotgun_api_ruby-0.0.4.1 lib/shotgun_api_ruby/entity.rb