mirror of
https://github.com/internetee/registry.git
synced 2025-06-06 20:55:44 +02:00
Split "big" method into two smaller ones
This commit is contained in:
parent
3aa978f722
commit
c7f95c41a2
1 changed files with 17 additions and 11 deletions
|
@ -63,17 +63,8 @@ class RetainedDomains
|
||||||
end
|
end
|
||||||
|
|
||||||
def domain_to_jsonable(domain)
|
def domain_to_jsonable(domain)
|
||||||
status = case domain
|
status = get_status(domain)
|
||||||
when ReservedDomain then RESERVED
|
domain_name = get_domain_name(domain)
|
||||||
when BlockedDomain then BLOCKED
|
|
||||||
when Dispute then DISPUTED
|
|
||||||
end
|
|
||||||
|
|
||||||
domain_name = case domain
|
|
||||||
when Dispute then domain.domain_name
|
|
||||||
else domain.name
|
|
||||||
end
|
|
||||||
|
|
||||||
punycode = SimpleIDN.to_ascii(domain_name)
|
punycode = SimpleIDN.to_ascii(domain_name)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -82,4 +73,19 @@ class RetainedDomains
|
||||||
punycode_name: punycode,
|
punycode_name: punycode,
|
||||||
}
|
}
|
||||||
end
|
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
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue