Class: SimpleTemplater::Hooks::FullName

Inherits:
Hook
  • Object
show all
Defined in:
lib/simple-templater/hooks/preprocess/full_name.rb

Instance Attribute Summary

Attributes inherited from Hook

#context, #reply

Instance Method Summary collapse

Methods inherited from Hook

find, hooks, inherited, #initialize, invoke, #key, #will_run?

Constructor Details

This class inherits a constructor from SimpleTemplater::Hooks::Hook

Instance Method Details

#questionObject



8
9
10
11
# File 'lib/simple-templater/hooks/preprocess/full_name.rb', line 8

def question
  name = ENV["USER"]
  CLI.ask("Input your name or press enter if '#{name}' is OK", default: name)
end

#runObject



13
14
15
# File 'lib/simple-templater/hooks/preprocess/full_name.rb', line 13

def run
  self.context.reverse_merge!(self.key => self.reply)
end