Class: Transform_into

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

Class Method Summary collapse

Class Method Details

.singular(var) ⇒ Object



25
26
27
# File 'lib/Util/transform_into.rb', line 25

def self.singular(var)
  var.singularize
end

.var_into_controller(var) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/Util/transform_into.rb', line 5

def self.var_into_controller(var)
  if var == ''

  else
    if var[-1] == 'y'
      var = "#{var[0...-1]}ies_controller"
    else
      var = "#{var}s_controller"
    end
  end
end

.var_into_method(var) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/Util/transform_into.rb', line 17

def self.var_into_method(var)
  if var.to_s[0] == '@'
   "#{(var.to_s)[1..-1]}_path"
  else
    var = "#{var}_path"
  end
end