Module: RailsAssist::Artifact::Files::Methods

Included in:
RailsAssist::Artifact::Files, RailsAssist::Artifact::Files
Defined in:
lib/rails_assist/artifact/files.rb

Instance Method Summary collapse

Instance Method Details

#asset_filepaths(*args) {|files| ... } ⇒ Object

Yields:

  • (files)


64
65
66
67
68
69
70
71
# File 'lib/rails_assist/artifact/files.rb', line 64

def asset_filepaths *args
  expr, name = Helper.get_asset_args args
  ext = last_option(args)[:ext]
  pattern = name ? "#{name.to_s.pluralize}/*.#{ext}*" : "**/*.#{ext}*"
  files = RailsAssist::Files.rails_app_files(:assets, :pattern => pattern).grep_it expr
  yield files if block_given?
  files
end

#asset_files(*args) {|files| ... } ⇒ Object

Yields:

  • (files)


73
74
75
76
77
# File 'lib/rails_assist/artifact/files.rb', line 73

def asset_files *args
  files = asset_filepaths(args).to_files
  yield files if block_given?
  files
end

#view_filepaths(*args) {|files| ... } ⇒ Object

Yields:

  • (files)


49
50
51
52
53
54
55
56
# File 'lib/rails_assist/artifact/files.rb', line 49

def view_filepaths *args
  expr, name = Helper.get_view_args args
  ext = last_option(args)[:template_language] || 'erb'
  pattern = name ? "#{name.to_s.pluralize}/*.#{ext}*" : "**/*.#{ext}*"
  files = RailsAssist::Files.rails_app_files(:views, :pattern => pattern).grep_it expr
  yield files if block_given?
  files
end

#view_files(*args) {|files| ... } ⇒ Object

Yields:

  • (files)


58
59
60
61
62
# File 'lib/rails_assist/artifact/files.rb', line 58

def view_files *args
  files = view_filepaths(args).to_files
  yield files if block_given?
  files
end