Module: RailsAssist::Artifact::Asset::SingleArg::StringArg

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

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(string) ⇒ Object

asset_file(‘stylesheets/localize’).should == /assets/stylesheets/localize.css/

Raises:

  • (ArgumentError)


116
117
118
119
120
121
122
123
124
# File 'lib/rails_artifactor/artifact/file_name/asset.rb', line 116

def self.get_asset_args string
  path_lvs = string.split('/')
  raise ArgumentError, "asset must be in a subfolder #{args}" if path_lvs.size < 2
  folder = path_lvs[0..-2].join('/')
  filename = path_lvs.last
  name = filename_name filename
  type = get_asset_type(filename_type filename)
  [folder, name, type]
end