Module: ParolkarInnovationLab::SocialNet::PfeedUtils

Extended by:
PfeedUtils
Included in:
PfeedUtils
Defined in:
lib/pfeed_utils.rb,
lib/pfeed/pfeed_utils.rb

Instance Method Summary collapse

Instance Method Details

#attempt_pass_tense(str_obj) ⇒ Object



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

def attempt_pass_tense str_obj
  #What can it do?
  # it can automagically transform
  # "addFriend" => "added_friend"
  # "fightWithFriend" => "faught_with_friend"
  # "buy_item" => "baught_item"
  #the magic trick "abhishekParolkar hu hu".underscore.parameterize.underscore.to_s
  str = str_obj.dup
  str = str.underscore.parameterize.underscore.to_s
  str_arr = str.split("_")
  str_arr[0] = str_arr[0].to_past_tense # this is from infectionist ( script/plugin install git://github.com/parolkar/inflectionist.git )
  str = str_arr.join("_")
end