Class: Fcoin::Validator
- Inherits:
-
Object
- Object
- Fcoin::Validator
- Defined in:
- lib/fcoin/validator.rb
Instance Method Summary collapse
-
#initialize(params) ⇒ Validator
constructor
A new instance of Validator.
-
#messages ⇒ Object
Error message when invalid.
-
#valid? ⇒ Boolean
Whether the parameters are valid?.
Constructor Details
#initialize(params) ⇒ Validator
Returns a new instance of Validator.
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/fcoin/validator.rb', line 17 def initialize(params) self.level = params[:level] self.resolution = params[:resolution] self.symbol = params[:symbol] self.side = params[:side] self.type = params[:type] self.price = params[:price] self.amount = params[:amount] self.states = params[:states] self.method_name = params[:method_name] end |
Instance Method Details
#messages ⇒ Object
Error message when invalid
35 36 37 |
# File 'lib/fcoin/validator.rb', line 35 def validator.present? ? validator. : {} end |
#valid? ⇒ Boolean
Whether the parameters are valid?
30 31 32 |
# File 'lib/fcoin/validator.rb', line 30 def valid? validator.present? ? validator.valid? : true end |