Sha256: 0eec3999bbe6ebf406870cca823b185c6436b97c0a46722f3366d7ce24093c66

Contents?: true

Size: 522 Bytes

Versions: 1

Compression:

Stored size: 522 Bytes

Contents

module Twitch
  class StreamMetadata
    attr_reader :user_id, :game_id

    def initialize(attributes = {})
      @user_id = attributes['user_id']
      @game_id = attributes['game_id']

      # Since more games can be supported in the future, this will ensure
      # they will all be available.
      attributes.each do |k, v|
        unless instance_variables.include?("@#{k}".to_sym)
          self.class.send(:attr_reader, k.to_sym)
          instance_variable_set("@#{k}", v)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
twitch-api-0.1.0 lib/twitch/stream_metadata.rb