class Termtter::ActiveRubytter

Public Class Methods

new(data) click to toggle source
# File lib/termtter/active_rubytter.rb, line 7
def initialize(data)
  self.attributes = data
end

Public Instance Methods

[](key) click to toggle source
# File lib/termtter/active_rubytter.rb, line 15
def [](key)
  @data[key]
end
attributes=(raw_hash) click to toggle source
# File lib/termtter/active_rubytter.rb, line 23
def attributes=(raw_hash)
  @data = {}
  raw_hash.each do |key, value|
    key_symbol = key.to_s.to_sym
    if value.kind_of? Hash
      @data[key_symbol] = ActiveRubytter.new(raw_hash[key])
    else
      @data[key_symbol] = raw_hash[key]
    end
  end
end
destructize() click to toggle source
# File lib/termtter/active_rubytter.rb, line 43
def destructize
  self.to_hash
end
id() click to toggle source
# File lib/termtter/active_rubytter.rb, line 11
def id
  @data[:id]
end
method_missing(name, *args) click to toggle source
# File lib/termtter/active_rubytter.rb, line 19
def method_missing(name, *args)
  @data[name]
end
retweeted_status() click to toggle source
# File lib/termtter/active_rubytter.rb, line 47
def retweeted_status
  nil
end
to_hash() click to toggle source
# File lib/termtter/active_rubytter.rb, line 35
def to_hash
  @data.inject({}) do |memo, (key, value)|
    memo[key] =
      (value.kind_of? self.class) ? value.to_hash : value
    memo
  end
end