Sha256: 706461299780c2633530b7b7d0edd3ec8b980b30de3314129f9a8760e5e77c2d

Contents?: true

Size: 476 Bytes

Versions: 3

Compression:

Stored size: 476 Bytes

Contents

module CanTango
  module Permits
    class Permit
      module ClassMethods
        def first_name clazz
          clazz.to_s.gsub(/^([A-Za-z]+).*/, '\1').underscore.to_sym # first part of class name
        end

        def type
          :abstract
        end

        def account_name clazz
          return nil if clazz.name == clazz.name.demodulize
          clazz.name.gsub(/::.*/,'').gsub(/(.*)Permits/, '\1').underscore.to_sym
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cantango-0.9.4.2 lib/cantango/permits/permit/class_methods.rb
cantango-0.9.4.1 lib/cantango/permits/permit/class_methods.rb
cantango-0.9.4 lib/cantango/permits/permit/class_methods.rb