Class: AnyValue::StringOfLength

Inherits:
AnyString show all
Defined in:
lib/any_value.rb

Instance Method Summary collapse

Methods inherited from AnyString

#to_str

Methods inherited from Anything

#^, #to_ary, #to_str

Constructor Details

#initialize(expected_length) ⇒ StringOfLength

Returns a new instance of StringOfLength.



134
135
136
137
# File 'lib/any_value.rb', line 134

def initialize(expected_length)
  super
  @expected_length = expected_length
end

Instance Method Details

#==(o) ⇒ Object



139
140
141
# File 'lib/any_value.rb', line 139

def ==(o)
  super && o.length == @expected_length 
end

#inspectObject



143
144
145
# File 'lib/any_value.rb', line 143

def inspect
  "#<StringOfLength #@expected_length>"
end