Class: FillHelpers

Inherits:
Object
  • Object
show all
Defined in:
lib/makeme/fill_helpers.rb

Instance Method Summary collapse

Constructor Details

#initialize(working_directory, absolute_file_path, guess_data) ⇒ FillHelpers

Returns a new instance of FillHelpers.



8
9
10
11
12
# File 'lib/makeme/fill_helpers.rb', line 8

def initialize(working_directory, absolute_file_path, guess_data)
  @working_directory = working_directory
  @absolute_file_path = absolute_file_path
  @guess_data = guess_data
end

Instance Method Details

#get_bindingObject



14
15
16
# File 'lib/makeme/fill_helpers.rb', line 14

def get_binding
  binding
end

#heuristic_projectObject



28
29
30
# File 'lib/makeme/fill_helpers.rb', line 28

def heuristic_project
  parent_directory
end

#heuristic_usernameObject



32
33
34
# File 'lib/makeme/fill_helpers.rb', line 32

def heuristic_username
  Etc.getlogin
end

#parent_directoryObject



18
19
20
21
22
23
24
25
26
# File 'lib/makeme/fill_helpers.rb', line 18

def parent_directory
  parent = Pathname.new(@absolute_file_path).parent.basename

  if parent
    parent.to_s
  else
    nil
  end
end

#projectObject



36
# File 'lib/makeme/fill_helpers.rb', line 36

def project;  heuristic_project  || Internal.placeholder("myproject"); end

#usernameObject



37
# File 'lib/makeme/fill_helpers.rb', line 37

def username; heuristic_username || Internal.placeholder("username");  end