Class: WordpressDirectory
- Inherits:
-
Object
- Object
- WordpressDirectory
- Defined in:
- lib/wordmove/wordpress_directory.rb,
lib/wordmove/wordpress_directory/path.rb
Defined Under Namespace
Modules: Path
Constant Summary collapse
- DEFAULT_PATHS =
{ Path::WP_CONTENT => 'wp-content', Path::WP_CONFIG => 'wp-config.php', Path::PLUGINS => 'wp-content/plugins', Path::MU_PLUGINS => 'wp-content/mu-plugins', Path::THEMES => 'wp-content/themes', Path::UPLOADS => 'wp-content/uploads', Path::LANGUAGES => 'wp-content/languages' }.freeze
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(type, options) ⇒ WordpressDirectory
constructor
A new instance of WordpressDirectory.
- #path(*args) ⇒ Object
- #relative_path(*args) ⇒ Object
- #url(*args) ⇒ Object
Constructor Details
#initialize(type, options) ⇒ WordpressDirectory
Returns a new instance of WordpressDirectory.
6 7 8 9 |
# File 'lib/wordmove/wordpress_directory.rb', line 6 def initialize(type, ) @type = type @options = end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
4 5 6 |
# File 'lib/wordmove/wordpress_directory.rb', line 4 def @options end |
#type ⇒ Object
Returns the value of attribute type.
4 5 6 |
# File 'lib/wordmove/wordpress_directory.rb', line 4 def type @type end |
Class Method Details
.default_path_for(sym) ⇒ Object
21 22 23 |
# File 'lib/wordmove/wordpress_directory.rb', line 21 def self.default_path_for(sym) DEFAULT_PATHS[sym] end |
Instance Method Details
#path(*args) ⇒ Object
25 26 27 |
# File 'lib/wordmove/wordpress_directory.rb', line 25 def path(*args) File.join([:wordpress_path], relative_path(*args)) end |
#relative_path(*args) ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/wordmove/wordpress_directory.rb', line 33 def relative_path(*args) path = if [:paths] && [:paths][type] [:paths][type] else DEFAULT_PATHS[type] end File.join(path, *args) end |
#url(*args) ⇒ Object
29 30 31 |
# File 'lib/wordmove/wordpress_directory.rb', line 29 def url(*args) File.join([:vhost], relative_path(*args)) end |