Class: Mayl::Env

Inherits:
Object
  • Object
show all
Defined in:
lib/mayl/env.rb

Overview

Public: Represents the global state with the loaded locales, and has the ability to save locales to disk.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Env

Public: Initializes a new Env loading the locales from a path.



10
11
12
13
14
# File 'lib/mayl/env.rb', line 10

def initialize(path)
  @locales    = Loader.load(path)
  @last_value = nil
  @namespace  = ""
end

Instance Attribute Details

#last_valueObject

Returns the value of attribute last_value.



6
7
8
# File 'lib/mayl/env.rb', line 6

def last_value
  @last_value
end

#localesObject (readonly)

Returns the value of attribute locales.



5
6
7
# File 'lib/mayl/env.rb', line 5

def locales
  @locales
end

#namespaceObject

Returns the value of attribute namespace.



7
8
9
# File 'lib/mayl/env.rb', line 7

def namespace
  @namespace
end

Instance Method Details

#commitObject

Public: Saves any changes to disk.



17
18
19
# File 'lib/mayl/env.rb', line 17

def commit
  @locales.each(&:commit)
end