Class: Githubris::Base

Inherits:
Object
  • Object
show all
Extended by:
CustomAttributes
Defined in:
lib/githubris/base.rb

Direct Known Subclasses

Gist, User

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Base

Returns a new instance of Base.



4
5
6
7
# File 'lib/githubris/base.rb', line 4

def initialize attributes={}
  @api = attributes.delete(:_api) || Githubris::API.new
  @attributes = attributes
end

Instance Method Details

#==(other) ⇒ Object



9
10
11
# File 'lib/githubris/base.rb', line 9

def ==(other)
  @attributes == other.instance_variable_get(:@attributes)
end

#swap_attributes(other) ⇒ Object



13
14
15
16
17
# File 'lib/githubris/base.rb', line 13

def swap_attributes(other)
  instance_variable_set(:@attributes,
                        other.instance_variable_get(:@attributes))
  self
end