Class: Traductor::Result

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(results: {}, errors: []) ⇒ Result

Returns a new instance of Result.



7
8
9
10
# File 'lib/traductor/result.rb', line 7

def initialize(results: {}, errors: [])
  @results = results
  @errors = errors
end

Instance Attribute Details

#errors ⇒ Object (readonly)

Returns the value of attribute errors.



5
6
7
# File 'lib/traductor/result.rb', line 5

def errors
  @errors
end

#results ⇒ Object (readonly)

Returns the value of attribute results.



5
6
7
# File 'lib/traductor/result.rb', line 5

def results
  @results
end

Instance Method Details

#locales ⇒ Object



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

def locales
  @results.keys
end

#path_for(locale) ⇒ Object



20
21
22
# File 'lib/traductor/result.rb', line 20

def path_for(locale)
  @results[locale.to_s]
end

#success? ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/traductor/result.rb', line 12

def success?
  @errors.empty?
end