Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/actn/core_ext/string.rb

Instance Method Summary collapse

Instance Method Details

#as_jsonObject



7
8
9
# File 'lib/actn/core_ext/string.rb', line 7

def as_json
  Oj.load(self)
end

#to_domainObject



10
11
12
13
# File 'lib/actn/core_ext/string.rb', line 10

def to_domain
  return self unless self.start_with?("http")
  self.match(/[http|http]:\/\/(\w*:\d*|\w*)\/?/)[1] rescue nil
end

#to_jsonObject



4
5
6
# File 'lib/actn/core_ext/string.rb', line 4

def to_json
  self
end