Module: Sirop

Defined in:
lib/sirop.rb,
lib/sirop/finder.rb,
lib/sirop/version.rb,
lib/sirop/injection.rb,
lib/sirop/sourcifier.rb

Defined Under Namespace

Classes: Error, Finder, Injection, Sourcifier

Constant Summary collapse

VERSION =

Sirop version

'0.4'

Class Method Summary collapse

Class Method Details

.to_ast(obj) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/sirop.rb', line 14

def to_ast(obj)
  case obj
  when Proc
    proc_ast(obj)
  when UnboundMethod, Method
    method_ast(obj)
  else
    raise ArgumentError, "Invalid object type"
  end
end

.to_source(obj) ⇒ Object



25
26
27
28
# File 'lib/sirop.rb', line 25

def to_source(obj)
  obj = to_ast(obj) if !obj.is_a?(Prism::Node)
  Sourcifier.new.to_source(obj)
end