Class: String

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

Overview

Used to add functionality to the Ruby String class.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#expectedObject

Returns the value of attribute expected.



3
4
5
# File 'lib/string.rb', line 3

def expected
  @expected
end

Class Method Details

.new(value, expected) ⇒ Object



5
6
7
8
9
# File 'lib/string.rb', line 5

def self.new(value, expected)
  string = value
  string.expected = expected
  string
end

Instance Method Details

#firstObject



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

def first
  self[0, 1]
end

#shift_left(num = 1) ⇒ Object



15
16
17
# File 'lib/string.rb', line 15

def shift_left(num = 1)
  self[num..-1]
end