Class: Txgh::TransifexProject

Inherits:
Object
  • Object
show all
Defined in:
lib/txgh/transifex_project.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config, api) ⇒ TransifexProject

Returns a new instance of TransifexProject.



5
6
7
8
# File 'lib/txgh/transifex_project.rb', line 5

def initialize(config, api)
  @config = config
  @api = api
end

Instance Attribute Details

#apiObject (readonly)

Returns the value of attribute api.



3
4
5
# File 'lib/txgh/transifex_project.rb', line 3

def api
  @api
end

#configObject (readonly)

Returns the value of attribute config.



3
4
5
# File 'lib/txgh/transifex_project.rb', line 3

def config
  @config
end

Instance Method Details

#auto_delete_resources?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/txgh/transifex_project.rb', line 33

def auto_delete_resources?
  Utils.booleanize(config['auto_delete_resources'] || 'false')
end

#languagesObject



41
42
43
# File 'lib/txgh/transifex_project.rb', line 41

def languages
  config.fetch('languages', [])
end

#nameObject



10
11
12
# File 'lib/txgh/transifex_project.rb', line 10

def name
  config['name']
end

#organizationObject



14
15
16
# File 'lib/txgh/transifex_project.rb', line 14

def organization
  config['organization']
end

#protected_branchesObject



22
23
24
25
26
27
# File 'lib/txgh/transifex_project.rb', line 22

def protected_branches
  @protected_branches ||=
    (config['protected_branches'] || '').split(',').map do |branch|
      Utils.absolute_branch(branch.strip)
    end
end

#serialization_optionsObject



45
46
47
# File 'lib/txgh/transifex_project.rb', line 45

def serialization_options
  config['serialization_options']
end

#supported_language?(language) ⇒ Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/txgh/transifex_project.rb', line 49

def supported_language?(language)
  languages.include?(language)
end

#tx_config_uriObject



37
38
39
# File 'lib/txgh/transifex_project.rb', line 37

def tx_config_uri
  config['tx_config']
end

#webhook_protected?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/txgh/transifex_project.rb', line 29

def webhook_protected?
  !(webhook_secret || '').empty?
end

#webhook_secretObject



18
19
20
# File 'lib/txgh/transifex_project.rb', line 18

def webhook_secret
  config['webhook_secret']
end