Class: FillHelpers
- Inherits:
-
Object
- Object
- FillHelpers
- Defined in:
- lib/makeme/fill_helpers.rb
Instance Method Summary collapse
- #get_binding ⇒ Object
- #heuristic_project ⇒ Object
- #heuristic_username ⇒ Object
-
#initialize(working_directory, absolute_file_path, guess_data) ⇒ FillHelpers
constructor
A new instance of FillHelpers.
- #parent_directory ⇒ Object
- #placeholder(text) ⇒ Object
- #project ⇒ Object
- #username ⇒ Object
Constructor Details
#initialize(working_directory, absolute_file_path, guess_data) ⇒ FillHelpers
Returns a new instance of FillHelpers.
2 3 4 5 6 |
# File 'lib/makeme/fill_helpers.rb', line 2 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_binding ⇒ Object
8 9 10 |
# File 'lib/makeme/fill_helpers.rb', line 8 def get_binding binding end |
#heuristic_project ⇒ Object
26 27 28 |
# File 'lib/makeme/fill_helpers.rb', line 26 def heuristic_project parent_directory end |
#heuristic_username ⇒ Object
30 31 32 |
# File 'lib/makeme/fill_helpers.rb', line 30 def heuristic_username Etc.getlogin end |
#parent_directory ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/makeme/fill_helpers.rb', line 16 def parent_directory parent = Pathname.new(@absolute_file_path).parent.basename if parent parent.to_s else nil end end |
#placeholder(text) ⇒ Object
12 13 14 |
# File 'lib/makeme/fill_helpers.rb', line 12 def placeholder(text) text.upcase end |
#project ⇒ Object
34 |
# File 'lib/makeme/fill_helpers.rb', line 34 def project; heuristic_project || placeholder("myproject"); end |
#username ⇒ Object
35 |
# File 'lib/makeme/fill_helpers.rb', line 35 def username; heuristic_username || placeholder("username"); end |