Class: Vocab::Settings
- Inherits:
-
Object
- Object
- Vocab::Settings
- Defined in:
- lib/vocab/settings.rb
Class Method Summary collapse
Instance Method Summary collapse
- #config_file ⇒ Object
-
#initialize(root) ⇒ Settings
constructor
A new instance of Settings.
- #last_translation ⇒ Object
- #update_translation ⇒ Object
- #write_settings ⇒ Object
Constructor Details
Class Method Details
Instance Method Details
#config_file ⇒ Object
8 9 10 |
# File 'lib/vocab/settings.rb', line 8 def config_file Pathname.new( "#{@root}/.vocab" ) end |
#last_translation ⇒ Object
12 13 14 |
# File 'lib/vocab/settings.rb', line 12 def last_translation return @local_config[ 'last_translation' ] end |
#update_translation ⇒ Object
16 17 18 19 20 21 |
# File 'lib/vocab/settings.rb', line 16 def update_translation current_sha = `git rev-parse HEAD`.strip @local_config[ 'last_translation' ] = current_sha write_settings return current_sha end |
#write_settings ⇒ Object
23 24 25 26 |
# File 'lib/vocab/settings.rb', line 23 def write_settings File.open( config_file, 'w' ) { |f| f.write( @local_config.to_yaml ) } `git add #{config_file}` end |