Class: Vanguard::Rule::Nullary::Confirmation::Builder::Confirm

Inherits:
Object
  • Object
show all
Includes:
AbstractType, Adamantium::Flat
Defined in:
lib/vanguard/rule/nullary/confirmation.rb

Overview

Abstract base class for confirmation attribute name generators

Defined Under Namespace

Classes: Block, Static

Class Method Summary collapse

Class Method Details

.build(value) ⇒ Confirm

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.

Build confirm object

Returns:



43
44
45
46
47
48
49
50
51
52
# File 'lib/vanguard/rule/nullary/confirmation.rb', line 43

def self.build(value)
  case value
  when value.respond_to?(:call)
    Block.new(value)
  when Symbol, String
    Static.new(value.to_sym)
  else
    raise "Cannot build confirm option from: #{value.inspect}"
  end
end