Class: Giggly::User

Inherits:
Object
  • Object
show all
Defined in:
lib/giggly/user.rb

Direct Known Subclasses

Friend

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ User

Returns a new instance of User.



6
7
8
# File 'lib/giggly/user.rb', line 6

def initialize(data)
  @data = data
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object



18
19
20
21
# File 'lib/giggly/user.rb', line 18

def method_missing(method, *args)
  super unless @data[method.to_s]
  @data[method.to_s]
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



4
5
6
# File 'lib/giggly/user.rb', line 4

def data
  @data
end

Instance Method Details

#[](value) ⇒ Object



14
15
16
# File 'lib/giggly/user.rb', line 14

def [](value) 
  @data[value.to_s]
end

#user_idObject



10
11
12
# File 'lib/giggly/user.rb', line 10

def user_id
  @data["UID"]
end