Module: RailsAssist::Artifact::View::FileName::Helper

Included in:
SingleArg::HashArg, SingleArg::HashArgs, SingleArg::StringArg, TwoArgs::ActionAndHash, TwoArgs::TwoLabels
Defined in:
lib/rails_artifactor/artifact/file_name/view.rb

Instance Method Summary collapse

Instance Method Details

#default_template_langObject



7
8
9
# File 'lib/rails_artifactor/artifact/file_name/view.rb', line 7

def default_template_lang
  get_type :erb
end

#filename_name(str) ⇒ Object



30
31
32
# File 'lib/rails_artifactor/artifact/file_name/view.rb', line 30

def filename_name str
  str.gsub /\.(.*)/, ''
end

#filename_type(str) ⇒ Object



26
27
28
# File 'lib/rails_artifactor/artifact/file_name/view.rb', line 26

def filename_type str
  str.split('.')[1..-1].join('.')
end

#get_type(type) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/rails_artifactor/artifact/file_name/view.rb', line 11

def get_type type
  case type.to_s
  when 'erb'
    'html.erb'
  when 'haml'
    'html.haml'
  else
    type
  end
end

#get_view_type(type) ⇒ Object



22
23
24
# File 'lib/rails_artifactor/artifact/file_name/view.rb', line 22

def get_view_type type
  get_type(type.empty? ? default_template_lang : type)
end