Module: Versionub

Defined in:
lib/versionub.rb,
lib/versionub/type.rb

Overview

– Copyleft meh. [meh.paranoid.pk | [email protected]]

This file is part of versionub.

versionub is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

versionub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with versionub. If not, see <www.gnu.org/licenses/>. ++

Defined Under Namespace

Classes: Type

Constant Summary collapse

Types =
{}

Class Method Summary collapse

Class Method Details

.create(data, type = :standard) ⇒ Object



29
30
31
# File 'lib/versionub.rb', line 29

def self.create (data, type=:standard)
   Types[type.to_sym].create(data)
end

.parse(text, type = :standard) ⇒ Object



23
24
25
26
27
# File 'lib/versionub.rb', line 23

def self.parse (text, type=:standard)
  return text if text.is_a?(Versionub::Type::Instance)

  Types[type.to_sym].parse(text.to_s)
end

.register(type, &block) ⇒ Object



33
34
35
# File 'lib/versionub.rb', line 33

def self.register (type, &block)
  Types[type.to_sym] = Versionub::Type.new(type.to_sym, &block)
end