Sha256: 3c1696e00d0dc5f9ef28bb8b5c78f38d2018e60c3c55a91abd0cdc66d31b0f08

Contents?: true

Size: 525 Bytes

Versions: 12

Compression:

Stored size: 525 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)
        attributes.respond_to?(name) || super
      end
    end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
shotgun_api_ruby-0.0.8.4 lib/shotgun_api_ruby/entity.rb
shotgun_api_ruby-0.0.8.3 lib/shotgun_api_ruby/entity.rb
shotgun_api_ruby-0.0.8.2 lib/shotgun_api_ruby/entity.rb
shotgun_api_ruby-0.0.8 lib/shotgun_api_ruby/entity.rb
shotgun_api_ruby-0.0.7 lib/shotgun_api_ruby/entity.rb
shotgun_api_ruby-0.0.5.3 lib/shotgun_api_ruby/entity.rb
shotgun_api_ruby-0.0.5.2 lib/shotgun_api_ruby/entity.rb
shotgun_api_ruby-0.0.5.1 lib/shotgun_api_ruby/entity.rb
shotgun_api_ruby-0.0.4 lib/shotgun_api_ruby/entity.rb
shotgun_api_ruby-0.0.3 lib/shotgun_api_ruby/entity.rb
shotgun_api_ruby-0.0.2 lib/shotgun_api_ruby/entity.rb
shotgun_api_ruby-0.0.1 lib/shotgun_api_ruby/entity.rb