Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/random_methods.rb

Instance Method Summary collapse

Instance Method Details

#domainObject

returns all of the url before and including the domain ending



74
75
76
77
78
79
80
81
82
83
# File 'lib/random_methods.rb', line 74

def domain # returns all of the url before and including the domain ending
  domainIndex = self.index(@@Domains)
  if domainIndex == nil then
    return nil
  else
    domainEnd = domainIndex + 2
    domainName = self[0..domainEnd]
    return domainName
  end
end

#halfObject



43
44
45
46
47
48
# File 'lib/random_methods.rb', line 43

def half
  strL = self.length
  strH = strL / 2
  newString = self[0..strH]
  return newString
end

#index_domainObject

made for link class



65
66
67
68
69
70
71
72
# File 'lib/random_methods.rb', line 65

def index_domain # gives index of the domain ending
  domainIndex = self.index(@@Domains)
  if domainIndex == nil then
    return nil
  else
    return domainIndex
  end
end

#quarterObject



50
51
52
53
54
55
# File 'lib/random_methods.rb', line 50

def quarter
  strL = self.length
  strH = strL / 4
  newString = self[0..strH]
  return newString
end

#three_quartersObject



57
58
59
60
61
62
# File 'lib/random_methods.rb', line 57

def three_quarters
  strL = self.length
  strH = strL - (strL / 4)
  newString = self[0..strH]
  return newString
end