Split "big" method into two smaller ones

This commit is contained in:
Maciej Szlosarczyk 2020-05-28 14:24:18 +03:00
parent 3aa978f722
commit c7f95c41a2
No known key found for this signature in database
GPG key ID: 41D62D42D3B0D765

View file

@ -63,17 +63,8 @@ class RetainedDomains
end
def domain_to_jsonable(domain)
status = case domain
when ReservedDomain then RESERVED
when BlockedDomain then BLOCKED
when Dispute then DISPUTED
end
domain_name = case domain
when Dispute then domain.domain_name
else domain.name
end
status = get_status(domain)
domain_name = get_domain_name(domain)
punycode = SimpleIDN.to_ascii(domain_name)
{
@ -82,4 +73,19 @@ class RetainedDomains
punycode_name: punycode,
}
end
def get_status(domain)
case domain
when ReservedDomain then RESERVED
when BlockedDomain then BLOCKED
when Dispute then DISPUTED
end
end
def get_domain_name(domain)
case domain
when Dispute then domain.domain_name
else domain.name
end
end
end