Module: RailsAssist::Artifact::Asset::SingleArg::HashArgs

Extended by:
FileName::Helper
Defined in:
lib/rails_artifactor/artifact/file_name/asset.rb

Constant Summary collapse

DIR =
RailsAssist::Artifact::Directory

Class Method Summary collapse

Methods included from FileName::Helper

filename_name, filename_type, get_asset_type, get_type, type_from

Class Method Details

.get_asset_args(hash) ⇒ Object

asset_file(:folder => ‘javascripts’, :name => ‘hello’, :type => :js).should == /assets/javascripts/hello.js/



97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/rails_artifactor/artifact/file_name/asset.rb', line 97

def self.get_asset_args hash
  try_folder = hash.keys.first
  try_asset_folder = File.expand_path(File.join(DIR.asset_dir, try_folder.to_s))
  if File.directory? try_asset_folder
    folder = try_folder
    name = hash.values.first
  else
    folder = hash[:folder]
    name = hash[:name]
  end
  type = get_asset_type(hash[:type] || folder)
  [folder, name, type]
end