Sha256: 4fa7c354eb5e997477175759b1435cb809ccde5022f2b2813f8da60fd2b389e7

Contents?: true

Size: 530 Bytes

Versions: 2

Compression:

Stored size: 530 Bytes

Contents

module CanTango::Macros
  module Clazz
    include CanTango::Macros::Account
    include CanTango::Macros::User
    
    def cantango type = nil
      # determine if user or account
      if !type
        (name =~ /.+Account$/) ? tango_account : tango_user
      else
        tango_account and return if type.to_s == 'account'
        tango_user and return if type.to_s == 'user'
        raise ArgumentError, "Unable to determine type of class to register; Please specify :user or :account as argument"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cantango-api-0.1.1 lib/cantango/api_ext/macros/clazz.rb
cantango-api-0.1.0 lib/cantango/api_ext/macros/clazz.rb