Class: Locale
- Inherits:
-
Object
- Object
- Locale
- Defined in:
- lib/locales_toys/template/locale.rb
Overview
Class for Locale file
Defined Under Namespace
Classes: HashCompare
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#hash ⇒ Object
readonly
Returns the value of attribute hash.
Class Method Summary collapse
Instance Method Summary collapse
- #diff(other) ⇒ Object
-
#initialize(code, hash) ⇒ Locale
constructor
A new instance of Locale.
Constructor Details
#initialize(code, hash) ⇒ Locale
Returns a new instance of Locale.
15 16 17 18 |
# File 'lib/locales_toys/template/locale.rb', line 15 def initialize(code, hash) @code = code @hash = hash end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
7 8 9 |
# File 'lib/locales_toys/template/locale.rb', line 7 def code @code end |
#hash ⇒ Object (readonly)
Returns the value of attribute hash.
7 8 9 |
# File 'lib/locales_toys/template/locale.rb', line 7 def hash @hash end |
Class Method Details
.load(context_directory) ⇒ Object
9 10 11 12 13 |
# File 'lib/locales_toys/template/locale.rb', line 9 def self.load(context_directory) Dir["#{context_directory}/locales/*.y{a,}ml"].map do |file| new File.basename(file, '.*'), YAML.load_file(file) || {} end end |
Instance Method Details
#diff(other) ⇒ Object
63 64 65 |
# File 'lib/locales_toys/template/locale.rb', line 63 def diff(other) HashCompare.new(hash, other.hash).different_keys end |