Class: MultiGit::JGitBackend::Config
- Inherits:
-
Object
- Object
- MultiGit::JGitBackend::Config
- Includes:
- Config
- Defined in:
- lib/multi_git/jgit_backend/config.rb
Constant Summary
Constants included from Config
Instance Attribute Summary collapse
-
#java_config ⇒ Object
(also: #to_java)
readonly
Returns the value of attribute java_config.
Instance Method Summary collapse
- #each_explicit_key ⇒ Object
- #get(section, subsection, name) ⇒ Object
-
#initialize(java_config) ⇒ Config
constructor
A new instance of Config.
Methods included from Config
#[], #default?, #each, #qualified_key, #schema, #schema_for, #section, #split_key, #to_h, #with_schema
Methods included from Utils::AbstractMethods
Constructor Details
#initialize(java_config) ⇒ Config
Returns a new instance of Config.
8 9 10 |
# File 'lib/multi_git/jgit_backend/config.rb', line 8 def initialize(java_config) @java_config = java_config end |
Instance Attribute Details
#java_config ⇒ Object (readonly) Also known as: to_java
Returns the value of attribute java_config.
45 46 47 |
# File 'lib/multi_git/jgit_backend/config.rb', line 45 def java_config @java_config end |
Instance Method Details
#each_explicit_key ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/multi_git/jgit_backend/config.rb', line 31 def each_explicit_key return to_enum(:each_explicit_key) unless block_given? java_config.sections.map do |sec| java_config.getNames(sec.to_java, nil.to_java).each do |name| yield sec, nil, name end java_config.getSubsections(sec.to_java).each do |subsec| java_config.getNames(sec.to_java, subsec.to_java).each do |name| yield sec, subsec, name end end end end |
#get(section, subsection, name) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/multi_git/jgit_backend/config.rb', line 12 def get(section, subsection, name) s = schema_for(section, subsection, name) if s.list? value = java_config.getStringList(section, subsection, name).to_a if value.any? return s.convert(value) else return s.default end else value = java_config.getString(section, subsection, name) if value.nil? return s.default else return s.convert( value ) end end end |