Module: Chaindrive::Gearbox Abstract

Defined in:
lib/chaindrive/gearbox.rb,
lib/chaindrive/gearbox/specification.rb

Overview

This module is abstract.

The reproducible definition of a system.

Defined Under Namespace

Classes: Specification

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.specificationsObject (readonly)

Returns the value of attribute specifications.



9
10
11
# File 'lib/chaindrive/gearbox.rb', line 9

def specifications
  @specifications
end

Class Method Details

.define(role = nil, &block) ⇒ Specification

Produce a Gearbox Specification from a block and hash.

Parameters:

  • role (String) (defaults to: nil)

    String to define the unique type.

Returns:



15
16
17
18
19
20
21
22
# File 'lib/chaindrive/gearbox.rb', line 15

def define(role = nil, &block)
  hash = { role: role.to_s } if role
  @@specifications ||= []
  Hashie::Blash.new(hash).tap do |m|
    yield m if block_given?
    return Specification.new(m).tap { |s| @@specifications << s }
  end
end