Class: Hashape::Specifiers::Specifier

Inherits:
Object
  • Object
show all
Defined in:
lib/hashape.rb

Overview

The basic specifier. You should probably never use this.

Direct Known Subclasses

Many, OneOf, Optional

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(spec) ⇒ Specifier

Creates a new specifier.

Parameters:

  • spec (*)

    The type spec for this specifier to match against.



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

def initialize(spec)
  @spec = spec
end

Instance Attribute Details

#specObject (readonly)

Returns the value of attribute spec.



15
16
17
# File 'lib/hashape.rb', line 15

def spec
  @spec
end

Class Method Details

.[](spec) ⇒ Specifier

A shorthand for constructing an instance of any specifier.

Parameters:

  • spec (*)

    The type spec for this specifier to match against.

Returns:



21
22
23
# File 'lib/hashape.rb', line 21

def self.[](spec)
  self.new(spec)
end