Top Level Namespace

Defined Under Namespace

Classes: Method_Name

Instance Method Summary collapse

Instance Method Details

#Method_Name(str) ⇒ Object

def Method_Name



25
26
27
28
29
30
# File 'lib/Method_Name.rb', line 25

def Method_Name str
  
  File.basename(str.strip.downcase)
  .gsub( %r!#{Method_Name::INVALID_REGEXP}+!, '_' )
  
end

#Method_Name?(str) ⇒ Boolean

Returns:

  • (Boolean)


3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/Method_Name.rb', line 3

def Method_Name? str
  
  return false if str[' ']
  return true unless str[Method_Name::INVALID_REGEXP]
  
  begin
    eval %!
      class Method_Name
        module Sandbox
          def #{str}
          end
        end
      end
    !

    true
  rescue Object => e
    false
  end

end