Defines the global configuration options for all YMDP classes. This is the class that knows about local settings such as server names, server application_ids, and configuration options such as when compression or validation is required on a view.
Set configuration options as a block with the configure
command.
YMDP::Base.configure do |config| config.username = "malreynolds" config.password = "firefly2591" config.default_server = "staging" config.host = "host" config.production_server = "www" config.growl = true config.verbose = false config.compress = @compress config.validate = @validate config.add_path(:base_path, @base_path) config.servers = @servers config.load_content_variables('content') end
These options are still evolving.
# File lib/ymdp/base.rb, line 67 def self.base_path configuration.paths[:base_path] end
# File lib/ymdp/base.rb, line 34 def self.configuration @@configuration ||= YMDP::Configuration::Setter.new end
Configures global YMDP settings. Sends a YMDP::Configuration::Setter instance to the block, which is used to define global settings.
# File lib/ymdp/base.rb, line 49 def self.configure yield configuration end
Parses out the base_path
setting from a path to display it in
a less verbose way.
# File lib/ymdp/base.rb, line 78 def self.display_path(path) path = File.expand_path(path) path.gsub(base_path.to_s, "") end
# File lib/ymdp/base.rb, line 71 def base_path self.class.base_path end
# File lib/ymdp/base.rb, line 42 def configuration @@configuration end
# File lib/ymdp/base.rb, line 38 def content_variables configuration.content_variables end
# File lib/ymdp/base.rb, line 83 def display_path(path) self.class.display_path(path) end
Returns the paths definition hash as an instance variable, making it available to instances of any class derived from YMDP::Base.
# File lib/ymdp/base.rb, line 63 def paths configuration.paths end
Returns the server definition hash as an instance variable, making it available to instances of any class derived from YMDP::Base.
# File lib/ymdp/base.rb, line 56 def servers configuration.servers end