Module: ROM::Auth::Support::ShorthandSymbol

Defined in:
lib/rom/auth/support/shorthand_symbol.rb

Class Method Summary collapse

Class Method Details

.strip(suffix) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/rom/auth/support/shorthand_symbol.rb', line 5

def self.strip(suffix)
  mod = Module.new

  mod.instance_eval <<-RUBY
    def included(cls)
      def cls.shorthand_symbol
        #name.split('::').last.gsub(/#{suffix.source}/,'').underscore.to_sym
        name.demodulize.gsub(/#{suffix.source}/,'').underscore.to_sym
      end
    end
  RUBY

  mod
end