Class: Kiel::SCM::Mock

Inherits:
Object
  • Object
show all
Defined in:
lib/kiel/scm/mock.rb

Overview

A mock, implementing the interface to a source code managment system

Instance Method Summary collapse

Constructor Details

#initialize(versions = {}) ⇒ Mock

Returns a new instance of Mock.



7
8
9
# File 'lib/kiel/scm/mock.rb', line 7

def initialize versions = {}
    @versions = versions
end

Instance Method Details

#version(step) ⇒ Object

returns the latest version of the given file

Raises:

  • (RuntimeError)


12
13
14
15
16
# File 'lib/kiel/scm/mock.rb', line 12

def version step
    step = step.to_s
    raise RuntimeError, "no mocked version for step \'#{step}\'" unless @versions.key? step
    @versions[ step ]
end

#versions(hash) ⇒ Object



19
20
21
# File 'lib/kiel/scm/mock.rb', line 19

def versions hash
    @versions = hash
end