Class: Taeval::GitCheckout::Config
- Inherits:
-
Object
- Object
- Taeval::GitCheckout::Config
- Includes:
- FileHelper
- Defined in:
- lib/taeval/git_checkout/config.rb
Instance Attribute Summary collapse
-
#attr ⇒ Object
readonly
Returns the value of attribute attr.
-
#branch ⇒ Object
readonly
Returns the value of attribute branch.
-
#fork_parent ⇒ Object
readonly
Returns the value of attribute fork_parent.
-
#prefix ⇒ Object
readonly
Returns the value of attribute prefix.
-
#solution ⇒ Object
readonly
Returns the value of attribute solution.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#tokens ⇒ Object
readonly
Returns the value of attribute tokens.
Instance Method Summary collapse
-
#initialize(conf_h) ⇒ Config
constructor
A new instance of Config.
Methods included from FileHelper
#create, #exist?, #flatten_include!, #open, #path_of
Constructor Details
#initialize(conf_h) ⇒ Config
Returns a new instance of Config.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/taeval/git_checkout/config.rb', line 11 def initialize(conf_h) @tokens = conf_h.fetch('token', '') file = open(path_of(conf_h['source'])) @source = file.readlines .map { |line| line.split(';').map(&:strip) } .map { |e| {name: e[0], id: e[1], host: e[2], user: e[3], repo: e[4]} } @attr = {} @attr[:private] = conf_h.fetch('private', true) @attr[:fork] = conf_h.fetch('fork', false) @attr[:forks_count] = conf_h.fetch('forks_count', 0).to_i @attr[:fork_parent] = conf_h.fetch('fork_parent', '') @branch = conf_h.fetch('branch', 'main') @prefix = conf_h.fetch('prefix', '') @solution = path_of(conf_h.dig('solution', 'path')) if !File.exist?(@solution) Dir.mkdir @solution end end |
Instance Attribute Details
#attr ⇒ Object (readonly)
Returns the value of attribute attr.
9 10 11 |
# File 'lib/taeval/git_checkout/config.rb', line 9 def attr @attr end |
#branch ⇒ Object (readonly)
Returns the value of attribute branch.
9 10 11 |
# File 'lib/taeval/git_checkout/config.rb', line 9 def branch @branch end |
#fork_parent ⇒ Object (readonly)
Returns the value of attribute fork_parent.
9 10 11 |
# File 'lib/taeval/git_checkout/config.rb', line 9 def fork_parent @fork_parent end |
#prefix ⇒ Object (readonly)
Returns the value of attribute prefix.
9 10 11 |
# File 'lib/taeval/git_checkout/config.rb', line 9 def prefix @prefix end |
#solution ⇒ Object (readonly)
Returns the value of attribute solution.
9 10 11 |
# File 'lib/taeval/git_checkout/config.rb', line 9 def solution @solution end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
9 10 11 |
# File 'lib/taeval/git_checkout/config.rb', line 9 def source @source end |
#tokens ⇒ Object (readonly)
Returns the value of attribute tokens.
9 10 11 |
# File 'lib/taeval/git_checkout/config.rb', line 9 def tokens @tokens end |