class YoutubeParser::Resource

Public Class Methods

new(hash = {}) click to toggle source
Calls superclass method
# File lib/youtube_parser/resource.rb, line 5
def initialize(hash = {})
  @hash = hash
  @default_method_value = hash.delete(:default_method_value)

  super(hash)
end

Public Instance Methods

attributes() click to toggle source
# File lib/youtube_parser/resource.rb, line 12
def attributes
  @attributes ||= @hash.transform_keys(&:to_sym)
end
keys() click to toggle source
# File lib/youtube_parser/resource.rb, line 16
def keys
  @keys ||= attributes.keys
end
method_missing(method, *args, &block) click to toggle source
Calls superclass method
# File lib/youtube_parser/resource.rb, line 20
def method_missing(method, *args, &block)
  super_method = super
  return super_method if super_method

  @default_method_value
end
respond_to_missing?(method_name, include_private = false) click to toggle source
Calls superclass method
# File lib/youtube_parser/resource.rb, line 27
def respond_to_missing?(method_name, include_private = false)
  @hash.keys.include?(method_name) ||
    @hash.keys.map(&:to_s).include?(method_name) || super
end