Module: Github::Base
- Included in:
- Notification, Repository, User
- Defined in:
- lib/hubdate/base.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(responseHash, conn = Github::Connection.new) ⇒ Object
Initialize module by gathering JSON hash and connection.
-
#method_missing(id, *args) ⇒ Object
If method doesnt exist, check if the id is a response key and if so return the value.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(id, *args) ⇒ Object
If method doesnt exist, check if the id is a response key and if so return the value
12 13 14 15 16 17 18 |
# File 'lib/hubdate/base.rb', line 12 def method_missing(id, *args) unless @response && @response.keys.include?(id.id2name) raise NoMethodError.new("Undefined method #{id.id2name} for #{self}: #{self.class}.") end @response[id.id2name] end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
3 4 5 |
# File 'lib/hubdate/base.rb', line 3 def connection @connection end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
3 4 5 |
# File 'lib/hubdate/base.rb', line 3 def response @response end |
Instance Method Details
#initialize(responseHash, conn = Github::Connection.new) ⇒ Object
Initialize module by gathering JSON hash and connection
6 7 8 9 |
# File 'lib/hubdate/base.rb', line 6 def initialize(responseHash, conn = Github::Connection.new) @connection = conn @response = responseHash end |