Class: SystemBrowser::Services::SourceService

Inherits:
AbstractService show all
Defined in:
lib/system_browser/services/source_service.rb

Instance Method Summary collapse

Methods inherited from AbstractService

#initialize, service_name

Constructor Details

This class inherits a constructor from SystemBrowser::Services::AbstractService

Instance Method Details

#getObject



4
5
6
7
8
9
10
11
12
13
# File 'lib/system_browser/services/source_service.rb', line 4

def get
  method = @other['method']['displayName']
  owner = SystemBrowser::Behaviour.from_str(@other['owner'])

  owner = (method.start_with?('#') ? owner : owner.singleton_class)
  unbound_method = owner.instance_method(method[1..-1].to_sym)
  source = FastMethodSource.comment_and_source_for(unbound_method)

  CodeRay.scan(self.unindent(source), :ruby).div
end