Class: Kanal::Core::Helpers::RouterProcParser

Inherits:
Object
  • Object
show all
Defined in:
lib/kanal/core/helpers/router_proc_parser.rb

Overview

Class helps with parsing router procs for helping forming handy DSL without commas

Instance Method Summary collapse

Instance Method Details

#get_conditions_method_names_from_block(&block) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/kanal/core/helpers/router_proc_parser.rb', line 11

def get_conditions_method_names_from_block(&block)
  source = block.source.to_s

  method_names = []

  lines = source.split "\n"

  lines.each do |l|
    names = get_method_names_from_line l

    method_names.concat names
  end

  method_names.uniq
end