Module: RailsAssist::Artifact::View::SingleArg::StringArg

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

Class Method Summary collapse

Methods included from FileName::Helper

default_template_lang, filename_name, filename_type, get_type, get_view_type

Class Method Details

.get_view_args(string) ⇒ Object

view_file(‘person/show’).should == /views/person/show.html.erb/

Raises:

  • (ArgumentError)


109
110
111
112
113
114
115
116
117
# File 'lib/rails_artifactor/artifact/file_name/view.rb', line 109

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