lib/jazzy/config.rb in jazzy-0.0.15 vs lib/jazzy/config.rb in jazzy-0.0.16
- old
+ new
@@ -12,10 +12,11 @@
attr_accessor :author_url
attr_accessor :dash_url
attr_accessor :sourcekitten_sourcefile
attr_accessor :clean
attr_accessor :readme_path
+ attr_accessor :docset_platform
def initialize
self.output = Pathname('docs')
self.xcodebuild_arguments = []
self.author_name = ''
@@ -24,10 +25,11 @@
self.github_file_prefix = nil
self.author_url = ''
self.dash_url = nil
self.sourcekitten_sourcefile = nil
self.clean = false
+ self.docset_platform = 'jazzy'
end
# rubocop:disable Metrics/MethodLength
def self.parse!
config = new
@@ -100,8 +102,38 @@
exit
end
end.parse!
config
+ end
+
+ #-------------------------------------------------------------------------#
+
+ # @!group Singleton
+
+ # @return [Config] the current config instance creating one if needed.
+ #
+ def self.instance
+ @instance ||= new
+ end
+
+ # Sets the current config instance. If set to nil the config will be
+ # recreated when needed.
+ #
+ # @param [Config, Nil] the instance.
+ #
+ # @return [void]
+ #
+ class << self
+ attr_writer :instance
+ end
+
+ # Provides support for accessing the configuration instance in other
+ # scopes.
+ #
+ module Mixin
+ def config
+ Config.instance
+ end
end
end
end