Class: CTT::Cli::Suites
Constant Summary collapse
- SUITES_CONFIG_FILE =
File.absolute_path(File.join(ENV["HOME"], ".tac/suites.yml"))
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#suites ⇒ Object
Returns the value of attribute suites.
Instance Method Summary collapse
-
#initialize ⇒ Suites
constructor
A new instance of Suites.
- #load ⇒ Object
- #save ⇒ Object
Constructor Details
#initialize ⇒ Suites
Returns a new instance of Suites.
13 14 15 16 |
# File 'lib/cli/suites.rb', line 13 def initialize load save end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
11 12 13 |
# File 'lib/cli/suites.rb', line 11 def file @file end |
#suites ⇒ Object
Returns the value of attribute suites.
9 10 11 |
# File 'lib/cli/suites.rb', line 9 def suites @suites end |
Instance Method Details
#load ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/cli/suites.rb', line 18 def load @file = SUITES_CONFIG_FILE unless Dir.exists?(File.dirname(@file)) Dir.mkdir(File.dirname(@file)) end if File.exists?(@file) @suites = YAML.load_file(@file) else @suites = {"suites" => {}} end end |
#save ⇒ Object
31 32 33 |
# File 'lib/cli/suites.rb', line 31 def save File.open(@file, "w") { |f| f.write YAML.dump(@suites) } end |