Class: SmartCore::Schema::Result Private

Inherits:
Object
  • Object
show all
Defined in:
lib/smart_core/schema/result.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0

Version:

  • 0.3.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source, errors, extra_keys, spread_keys) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • source (Hash<String|Symbol,Any>)
  • errors (Hash<String,Array<Symbol>])

    rrors [Hash<String,Array<Symbol>]

  • extra_keys (Set<String>)
  • spread_keys (Set<String>)

Since:

  • 0.1.0

Version:

  • 0.3.0



40
41
42
43
44
45
# File 'lib/smart_core/schema/result.rb', line 40

def initialize(source, errors, extra_keys, spread_keys)
  @source = source
  @errors = errors
  @extra_keys = extra_keys
  @spread_keys = spread_keys
end

Instance Attribute Details

#errorsHash<String,Array<Symbol>> (readonly)

Returns:

  • (Hash<String,Array<Symbol>>)

Since:

  • 0.1.0



17
18
19
# File 'lib/smart_core/schema/result.rb', line 17

def errors
  @errors
end

#extra_keysSet<String> (readonly)

Returns:

  • (Set<String>)

Since:

  • 0.1.0



23
24
25
# File 'lib/smart_core/schema/result.rb', line 23

def extra_keys
  @extra_keys
end

#sourceHash<String,Any> (readonly)

Returns:

  • (Hash<String,Any>)

Since:

  • 0.1.0



11
12
13
# File 'lib/smart_core/schema/result.rb', line 11

def source
  @source
end

#spread_keysSet<String> (readonly)

Returns:

  • (Set<String>)

Since:

  • 0.3.0



29
30
31
# File 'lib/smart_core/schema/result.rb', line 29

def spread_keys
  @spread_keys
end

Instance Method Details

#failure?Boolean

Returns:

  • (Boolean)

Since:

  • 0.1.0



59
60
61
# File 'lib/smart_core/schema/result.rb', line 59

def failure?
  errors.any? || extra_keys.any?
end

#success?Boolean

Returns:

  • (Boolean)

Since:

  • 0.1.0



51
52
53
# File 'lib/smart_core/schema/result.rb', line 51

def success?
  errors.empty? && extra_keys.empty?
end