Module: RailsAssist::Directory::Methods

Included in:
RailsAssist::Directory, RailsAssist::Directory
Defined in:
lib/rails_assist/directory.rb

Overview

dir_for helpers


Constant Summary collapse

DIR =
RailsAssist::Artifact::Directory

Instance Method Summary collapse

Instance Method Details

#app_dir_for(type, options = {}) ⇒ Object



53
54
55
# File 'lib/rails_assist/directory.rb', line 53

def app_dir_for type, options={}
  ::File.join(app_dirpath(options), type.to_s.pluralize)
end

#config_dir_for(type, options = {}) ⇒ Object



57
58
59
# File 'lib/rails_assist/directory.rb', line 57

def config_dir_for type, options={}
  ::File.join(config_dirpath(options), type.to_s.pluralize)
end

#public_dir_for(type, options = {}) ⇒ Object



61
62
63
# File 'lib/rails_assist/directory.rb', line 61

def public_dir_for type, options={}
  ::File.join(public_dirpath(options), type.to_s.pluralize)
end

#rails_dir_for(type, options = {}) ⇒ Object

Raises:

  • (ArgumentError)


46
47
48
49
50
51
# File 'lib/rails_assist/directory.rb', line 46

def rails_dir_for type, options={}
  raise ArgumentError, '#rails_dir_for takes a dir type argument' if !type
  dir_method = "#{type}_dirpath"
  return send(dir_method, options) if respond_to?(dir_method)
  DIR.send(dir_method, options) if DIR.respond_to?(dir_method)
end