Method: Cathode::Version.define

Defined in:
lib/cathode/version.rb

.define(version_number, &block) ⇒ Version

Defines a new version.

Parameters:

  • version_number (String, Fixnum, Float)

    A number or string representing a SemVer-compliant version number. If a Fixnum or Float is passed, it will be converted to a string before being evaluated for SemVer compliance, so passing 1.5 is equivalent to passing ‘’1.5.0’‘.

  • block

    A block defining the version’s resources and actions, and has access to the methods in the ActionDsl and ResourceDsl

Returns:



25
26
27
28
29
30
31
32
33
# File 'lib/cathode/version.rb', line 25

def define(version_number, &block)
  version = Version.find(version_number)
  if version.present?
    version.instance_eval(&block)
  else
    version = self.new(version_number, &block)
  end
  version
end