class GooglePlus::Base

Attributes

attrs[RW]
to_hash[RW]

Public Class Methods

lazy_attr_reader(*attrs) click to toggle source

Define methods that retrieve the value from an initialized instance variable Hash, using the attribute as a key

@overload self.lazy_attr_reader(attr)

@param attr [Symbol]

@overload self.lazy_attr_reader(attrs)

@param attrs [Array<Symbol>]
# File lib/google_plus/base.rb, line 12
def self.lazy_attr_reader(*attrs)
  attrs.each do |attribute|
    class_eval do
      define_method attribute do
        @attrs[attribute.to_s]
      end
    end
  end
end
new(attrs={}) click to toggle source

Initializes a new Base object

@param attrs [Hash] @return [GooglePlus::Base]

# File lib/google_plus/base.rb, line 26
def initialize(attrs={})
  @attrs = attrs.dup
end

Public Instance Methods

[](method) click to toggle source

Initializes a new Base object

@param method [String, Symbol] Message to send to the object

# File lib/google_plus/base.rb, line 33
def [](method)
  self.__send__(method.to_sym)
end