Module: Fend::Plugins::Core::ResultMethods

Defined in:
lib/fend.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#inputObject (readonly)

Get raw input data



271
272
273
# File 'lib/fend.rb', line 271

def input
  @input
end

#outputObject (readonly)

Get output data



274
275
276
# File 'lib/fend.rb', line 274

def output
  @output
end

Instance Method Details

#failure?Boolean

Check if if validation failed

Returns:

  • (Boolean)


290
291
292
# File 'lib/fend.rb', line 290

def failure?
  !success?
end

#fend_classObject



299
300
301
# File 'lib/fend.rb', line 299

def fend_class
  self.class.fend_class
end

#initialize(args = {}) ⇒ Object



276
277
278
279
280
# File 'lib/fend.rb', line 276

def initialize(args = {})
  @input = args.fetch(:input)
  @output = args.fetch(:output)
  @errors = args.fetch(:errors)
end

#inspectObject



303
304
305
# File 'lib/fend.rb', line 303

def inspect
  "#{fend_class.inspect}::Result"
end

#messagesObject

Get error messages



283
284
285
286
287
# File 'lib/fend.rb', line 283

def messages
  return {} if success?

  @errors
end

#success?Boolean

Check if if validation succeeded

Returns:

  • (Boolean)


295
296
297
# File 'lib/fend.rb', line 295

def success?
  @errors.empty?
end

#to_sObject



307
308
309
# File 'lib/fend.rb', line 307

def to_s
  "#{fend_class.inspect}::Result"
end