Module: Rails3::Assist::Artifact::View::SingleArg::HashArgs

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

Constant Summary collapse

DIR =
Rails3::Assist::Artifact::Directory

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

view_file(:folder => ‘person’, :action => :show, :type => :erb).should == /views/person/show.html.erb/



91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/rails3_artifactor/artifact/file_name/view.rb', line 91

def self.get_view_args hash
  try_folder = hash.keys.first
  try_view_folder = File.expand_path(File.join(DIR.view_dir, try_folder.to_s))
  if File.directory? try_view_folder
    folder = try_folder          
    action = hash.values.first
  else
    folder = hash[:folder]          
    action = hash[:action]
  end            
  type = get_view_type(hash[:type])
  [folder, action, type]
end