1
0
Fork 0
mirror of https://github.com/nov/fb_graph2 synced 2023-03-27 23:22:15 -04:00

FbGraph2.object_classes & FbGraph2::Node#edges

This commit is contained in:
nov 2014-06-02 18:26:39 +09:00
parent 971267e893
commit 8fb5fdf9e0
2 changed files with 9 additions and 1 deletions

View file

@ -2,12 +2,13 @@ require 'active_support/all'
require 'rack/oauth2' require 'rack/oauth2'
module FbGraph2 module FbGraph2
cattr_accessor :api_version, :gem_version, :logger, :debugging, :_http_config_ cattr_accessor :api_version, :gem_version, :logger, :debugging, :_http_config_, :object_classes
self.api_version = 'v2.0' self.api_version = 'v2.0'
self.gem_version = File.read(File.join(__dir__, '../VERSION')).delete("\n\r") self.gem_version = File.read(File.join(__dir__, '../VERSION')).delete("\n\r")
self.logger = Logger.new(STDOUT) self.logger = Logger.new(STDOUT)
self.logger.progname = 'FbGraph2' self.logger.progname = 'FbGraph2'
self.object_classes = Array.new
class << self class << self
def root_url def root_url

View file

@ -4,6 +4,7 @@ module FbGraph2
def self.inherited(klass) def self.inherited(klass)
klass.include AttributeAssigner klass.include AttributeAssigner
FbGraph2.object_classes << klass
end end
def initialize(id, attributes = {}) def initialize(id, attributes = {})
@ -36,6 +37,12 @@ module FbGraph2
) )
end end
def edges
@edges ||= self.class.included_modules.select do |_module_|
_module_.name =~ /FbGraph2::Edge/
end.collect(&:instance_methods).sort
end
def destroy(params = {}, options = {}) def destroy(params = {}, options = {})
delete params, options delete params, options
end end