Class: String

Inherits:
Object
Defined in:
example_code.rb

Method Summary

Method Details

- (Object) pig_latin

Pig latin of a String

Specifications:

  • should be a pig!
    
    
    16
    # File 'example_code.rb', line 16
    
    "hello".pig_latin.should == "ellohay"
  • should fail to be a pig!
    
    
    20
    # File 'example_code.rb', line 20
    
    "hello".pig_latin.should == "hello"


6
7
8
# File 'example_code.rb', line 6

def pig_latin
  self[1..-1] + self[0] + "ay"
end