Class: DiffTools::Chunk
Instance Attribute Summary collapse
-
#contents ⇒ Object
readonly
Returns the value of attribute contents.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(anObject) ⇒ Chunk
constructor
A new instance of Chunk.
- #inspect ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(anObject) ⇒ Chunk
Returns a new instance of Chunk.
74 75 76 77 78 79 80 81 82 83 |
# File 'lib/diff_tools.rb', line 74 def initialize ( anObject ) case anObject when String @path = anObject[/\AIndex: (.+)$/, 1] raise ArgumentError, "The path cannot be empty (#{anObject})" if @path.nil? or @path.empty? @contents = anObject else raise TypeError, "Unexpected type #{anObject.class}" end end |