Class: Moon::Validator::Format

Inherits:
Object
  • Object
show all
Defined in:
lib/moon/validator/format.rb

Overview

Value format validator.

Instance Method Summary collapse

Constructor Details

#initialize(format) ⇒ Format

Returns a new instance of Format.



5
6
7
# File 'lib/moon/validator/format.rb', line 5

def initialize(format)
  @format = format
end

Instance Method Details

#messages(value, context) ⇒ Object



9
10
11
# File 'lib/moon/validator/format.rb', line 9

def messages(value, context)
  value =~ @format ? [ ] : [ "Has a wrong format." ]
end