Class: RulerCoaster::Attributes::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/ruler_coaster/attributes/result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rules, input, errors, blocked = {}) ⇒ Result

Returns a new instance of Result.



9
10
11
12
13
14
# File 'lib/ruler_coaster/attributes/result.rb', line 9

def initialize(rules, input, errors, blocked = {})
  @rules = rules
  @input = input
  @errors = errors
  @blocked = blocked
end

Instance Attribute Details

#blockedObject (readonly)

Returns the value of attribute blocked.



4
5
6
# File 'lib/ruler_coaster/attributes/result.rb', line 4

def blocked
  @blocked
end

#errorsObject (readonly)

Returns the value of attribute errors.



4
5
6
# File 'lib/ruler_coaster/attributes/result.rb', line 4

def errors
  @errors
end

#inputObject (readonly)

Returns the value of attribute input.



4
5
6
# File 'lib/ruler_coaster/attributes/result.rb', line 4

def input
  @input
end

#rulesObject (readonly)

Returns the value of attribute rules.



4
5
6
# File 'lib/ruler_coaster/attributes/result.rb', line 4

def rules
  @rules
end

Instance Method Details

#success?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/ruler_coaster/attributes/result.rb', line 16

def success?
  @errors.keys.empty? && @blocked.empty?
end