Class: Vanguard::Builder::Nullary

Inherits:
Vanguard::Builder show all
Includes:
AbstractType
Defined in:
lib/vanguard/builder/nullary.rb

Overview

Abstract base class for nullary builders

Constant Summary collapse

OPTIONS =
[].freeze
REQUIRED_OPTIONS =
[].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#argumentsEnumerable<Object> (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return arguments

Returns:

  • (Enumerable<Object>)


32
33
34
# File 'lib/vanguard/builder/nullary.rb', line 32

def arguments
  @arguments
end

#klassClass (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return arguments

Returns:

  • (Class)


24
25
26
# File 'lib/vanguard/builder/nullary.rb', line 24

def klass
  @klass
end

#optionsHash (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return options

Returns:

  • (Hash)


16
17
18
# File 'lib/vanguard/builder/nullary.rb', line 16

def options
  @options
end

Class Method Details

.run(*arguments) ⇒ Enumerable<Rule>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Run builder

Returns:

  • (Enumerable<Rule>)


93
94
95
# File 'lib/vanguard/builder/nullary.rb', line 93

def self.run(*arguments)
  new(*arguments).rules
end

Instance Method Details

#allowed_optionsEnumerable<Symbol>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return allowed options

Returns:

  • (Enumerable<Symbol>)


73
74
75
# File 'lib/vanguard/builder/nullary.rb', line 73

def allowed_options
  self.class::OPTIONS
end

#matcherMatcher

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return matcher

Returns:



52
53
54
# File 'lib/vanguard/builder/nullary.rb', line 52

def matcher
  klass::MATCHER
end

#required_optionsEnumerable<Symbol>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return required options

Returns:

  • (Enumerable<Symbol>)


83
84
85
# File 'lib/vanguard/builder/nullary.rb', line 83

def required_options
  self.class::REQUIRED_OPTIONS
end

#rule(attribute_name) ⇒ Rule

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return rule for attribute name

Parameters:

  • attribute_name (Symbol)

Returns:



42
43
44
# File 'lib/vanguard/builder/nullary.rb', line 42

def rule(attribute_name)
  klass.new(attribute_name, matcher)
end

#rulesObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return rules



60
61
62
63
64
# File 'lib/vanguard/builder/nullary.rb', line 60

def rules
  arguments.map do |attribute_name|
    rule(attribute_name)
  end
end