Module: Statemachine::Generate::Util
- Included in:
- DotGraph::DotGraphStatemachine, Java::JavaStatemachine
- Defined in:
- lib/statemachine/generate/util.rb
Instance Method Summary collapse
- #create_file(filename, content) ⇒ Object
- #endl ⇒ Object
- #establish_directory(path) ⇒ Object
- #say(message) ⇒ Object
- #timestamp ⇒ Object
Instance Method Details
#create_file(filename, content) ⇒ Object
7 8 9 10 11 12 |
# File 'lib/statemachine/generate/util.rb', line 7 def create_file(filename, content) establish_directory(File.dirname(filename)) File.open(filename, 'w') do |file| file.write(content) end end |
#endl ⇒ Object
24 25 26 |
# File 'lib/statemachine/generate/util.rb', line 24 def endl return :endl end |
#establish_directory(path) ⇒ Object
14 15 16 17 18 |
# File 'lib/statemachine/generate/util.rb', line 14 def establish_directory(path) return if File.exist?(path) establish_directory(File.dirname(path)) Dir.mkdir(path) end |
#say(message) ⇒ Object
28 29 30 31 32 |
# File 'lib/statemachine/generate/util.rb', line 28 def say() if !defined?($IS_TEST) puts end end |
#timestamp ⇒ Object
20 21 22 |
# File 'lib/statemachine/generate/util.rb', line 20 def return DateTime.now.strftime("%H:%M:%S %B %d, %Y") end |