Class: Txgh::ResourceCommitter
- Inherits:
-
Object
- Object
- Txgh::ResourceCommitter
- Defined in:
- lib/txgh/resource_committer.rb
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
-
#repo ⇒ Object
readonly
Returns the value of attribute repo.
Instance Method Summary collapse
- #commit_resource(tx_resource, branch, language) ⇒ Object
-
#initialize(project, repo, logger = nil) ⇒ ResourceCommitter
constructor
A new instance of ResourceCommitter.
Constructor Details
#initialize(project, repo, logger = nil) ⇒ ResourceCommitter
Returns a new instance of ResourceCommitter.
5 6 7 8 9 |
# File 'lib/txgh/resource_committer.rb', line 5 def initialize(project, repo, logger = nil) @project = project @repo = repo @logger = logger || Logger.new(STDOUT) end |
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
3 4 5 |
# File 'lib/txgh/resource_committer.rb', line 3 def logger @logger end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
3 4 5 |
# File 'lib/txgh/resource_committer.rb', line 3 def project @project end |
#repo ⇒ Object (readonly)
Returns the value of attribute repo.
3 4 5 |
# File 'lib/txgh/resource_committer.rb', line 3 def repo @repo end |
Instance Method Details
#commit_resource(tx_resource, branch, language) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/txgh/resource_committer.rb', line 11 def commit_resource(tx_resource, branch, language) return if prevent_commit_on?(branch) unless language == tx_resource.source_lang file_name, translations = download(tx_resource, branch, language) if translations repo.api.commit(repo.name, branch, { file_name => translations }) end end end |