Class: Hanami::Validations::InlinePredicate Private

Inherits:
Object
  • Object
show all
Defined in:
lib/hanami/validations/inline_predicate.rb

Overview

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

Inline predicate

Since:

  • 0.6.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, message, &blk) ⇒ Hanami::Validations::InlinePredicate

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 a new instance.

Parameters:

  • name (Symbol)

    inline predicate name

  • message (String)

    optional failure message

  • blk (Proc)

    predicate implementation

Since:

  • 0.6.0



26
27
28
29
30
# File 'lib/hanami/validations/inline_predicate.rb', line 26

def initialize(name, message, &blk)
  @name    = name
  @message = message
  @blk     = blk
end

Instance Attribute Details

#messageObject (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.

Since:

  • 0.6.0



14
15
16
# File 'lib/hanami/validations/inline_predicate.rb', line 14

def message
  @message
end

#nameObject (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.

Since:

  • 0.6.0



10
11
12
# File 'lib/hanami/validations/inline_predicate.rb', line 10

def name
  @name
end

Instance Method Details

#==(other) ⇒ Object

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.

Since:

  • 0.6.0



40
41
42
43
# File 'lib/hanami/validations/inline_predicate.rb', line 40

def ==(other)
  self.class == other.class &&
    name == other.name
end

#to_procObject

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.

Since:

  • 0.6.0



34
35
36
# File 'lib/hanami/validations/inline_predicate.rb', line 34

def to_proc
  @blk
end