Class: Repository::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/devlogs/repository/config.rb

Defined Under Namespace

Classes: MirrorConfig

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, opts = {}) ⇒ Config

Returns a new instance of Config.



12
13
14
15
16
17
18
19
# File 'lib/devlogs/repository/config.rb', line 12

def initialize(path, opts = {})
  @file_path = path
  @template_file_path = opts[:template_file_path]
  @name = opts[:name]
  @short_code = opts[:short_code]
  @description = opts[:description]
  @mirror = MirrorConfig.new(opts[:mirror])
end

Instance Attribute Details

#descriptionObject (readonly)

FIXME: Need to figure out file path



7
8
9
# File 'lib/devlogs/repository/config.rb', line 7

def description
  @description
end

#file_pathObject (readonly)

FIXME: Need to figure out file path



7
8
9
# File 'lib/devlogs/repository/config.rb', line 7

def file_path
  @file_path
end

#mirrorObject (readonly)

FIXME: Need to figure out file path



7
8
9
# File 'lib/devlogs/repository/config.rb', line 7

def mirror
  @mirror
end

#nameObject (readonly)

FIXME: Need to figure out file path



7
8
9
# File 'lib/devlogs/repository/config.rb', line 7

def name
  @name
end

#short_codeObject (readonly)

FIXME: Need to figure out file path



7
8
9
# File 'lib/devlogs/repository/config.rb', line 7

def short_code
  @short_code
end

#template_file_pathObject (readonly)

FIXME: Need to figure out file path



7
8
9
# File 'lib/devlogs/repository/config.rb', line 7

def template_file_path
  @template_file_path
end

Instance Method Details

#mirror?Boolean

Returns whether or not the devlogs repository is configured to mirror

Returns:

  • (Boolean)


24
25
26
# File 'lib/devlogs/repository/config.rb', line 24

def mirror?
  @mirror.use_mirror
end

#path(with_trailing: false) ⇒ Object

Ensures no weird double trailing slash path values



29
30
31
32
33
34
35
# File 'lib/devlogs/repository/config.rb', line 29

def path(with_trailing: false)
  if with_trailing
    @file_path[-1] == "/" ? @path_value : @path_value + "/"
  else
    @file_path
  end
end