Funny way to check role in Ruby

Member

jerald_rippin

by jerald_rippin , in category: Ruby , 2 months ago

Funny way to check role in Ruby 😗

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
def type
    return 'Anonymous'   if self.builtin == BUILTIN_ANONYMOUS
    return 'Non Member'  if self.builtin == BUILTIN_NON_MEMBER
    return 'Member'      if self.builtin == BUILTIN_MEMBER
    return 'User'        if self.builtin == BUILTIN_USER
    return 'Manager'     if self.builtin == BUILTIN_MANAGER
    return 'Architect'   if self.builtin == BUILTIN_ARCHITECT
    return 'Designer'    if self.builtin == BUILTIN_DESIGNER
    return 'Customer'    if self.builtin == BUILTIN_CUSTOMER
    return 'Vendor'      if self.builtin == BUILTIN_VENDOR
    return 'Dealer'      if self.builtin == BUILTIN_DEALER
  end

  def require_name
    return 'is_anonymous'   if self.builtin == BUILTIN_ANONYMOUS
    return 'is_non_member'  if self.builtin == BUILTIN_NON_MEMBER
    return 'is_member'      if self.builtin == BUILTIN_MEMBER
    return 'is_user'        if self.builtin == BUILTIN_USER
    return 'is_manager'     if self.builtin == BUILTIN_MANAGER
    return 'is_architect'   if self.builtin == BUILTIN_ARCHITECT
    return 'is_designer'    if self.builtin == BUILTIN_DESIGNER
    return 'is_customer'    if self.builtin == BUILTIN_CUSTOMER
    return 'is_vendor'      if self.builtin == BUILTIN_VENDOR
    return 'is_dealer'      if self.builtin == BUILTIN_DEALER
  end


Facebook Twitter LinkedIn Telegram Whatsapp Pocket

no answers