Module: Fcoin::ValidatorUtility

Included in:
MarketValidator, Orders::CreateOrderLimitValidator, Orders::CreateOrderMarketValidator, Orders::OrderListValidator
Defined in:
lib/fcoin/validator/validator_utility.rb

Instance Method Summary collapse

Instance Method Details

#between_error_message(target, target_type, min, max) ⇒ Object



10
11
12
13
14
15
# File 'lib/fcoin/validator/validator_utility.rb', line 10

def between_error_message(target, target_type, min, max)
  message = {}
  target_value = target.present? ? target : 'nil'
  message[target_type] = "#{target_type} is #{target_value}. #{target_type} is not between #{min} and #{max}."
  message
end

#includes_error_message(target, target_type, list) ⇒ Object



3
4
5
6
7
8
# File 'lib/fcoin/validator/validator_utility.rb', line 3

def includes_error_message(target, target_type, list)
  message = {}
  target_value = target.present? ? target : 'nil'
  message[target_type] = "#{target_type} is #{target_value}. #{target_type} is not included in the [#{list.join(', ')}]."
  message
end

#presence_error_message(target, target_type) ⇒ Object



17
18
19
20
21
22
# File 'lib/fcoin/validator/validator_utility.rb', line 17

def presence_error_message(target, target_type)
  message = {}
  target_value = target.present? ? target : 'nil'
  message[target_type] = "#{target_type} is #{target_value}. #{target_type} can't be blank"
  message
end