Module: Sourcify::Method::Methods::ToSource

Defined in:
lib/sourcify/lib/sourcify/method/methods/to_source.rb

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/sourcify/lib/sourcify/method/methods/to_source.rb', line 5

def self.included(base)
  base.class_eval do

    Sourcify.require_rb('method', 'parser')

    if IS_PLATFORM_SUPPORTED

      def to_source(opts = {}, &body_matcher)
        (@sourcified_parser ||= Parser.new(self)).
          source(opts.merge(:body_matcher => body_matcher))
      end

    else

      def to_source(*args)
        raise PlatformNotSupportedError
      end

    end

  end
end