Class: Csa::Ccm::Cli::Resource

Inherits:
Object
  • Object
show all
Defined in:
lib/csa/ccm/cli/resource.rb

Class Method Summary collapse

Class Method Details

.lookup_version(version) ⇒ Object



13
14
15
# File 'lib/csa/ccm/cli/resource.rb', line 13

def self.lookup_version(version)
  Dir["#{root_gem}/resources/**/*v#{version}*.xlsx"]
end

.root_gemObject



9
10
11
# File 'lib/csa/ccm/cli/resource.rb', line 9

def self.root_gem
  Pathname.new(__dir__).join('..', '..', '..', '..')
end

.to_file(hash, output_file) ⇒ Object



17
18
19
20
21
# File 'lib/csa/ccm/cli/resource.rb', line 17

def self.to_file(hash, output_file)
  File.open(output_file, 'w') { |f| f.write hash.to_yaml(line_width: 9999) }
rescue Errno::ENOENT => e
  UI.say("Cannot write result to #{output_file} because: #{e.message}")
end