class Anonymise::Resource
Attributes
path[R]
Public Class Methods
new(path)
click to toggle source
# File lib/anonymise/resource.rb, line 8 def initialize(path) @path = path end
Public Instance Methods
content()
click to toggle source
# File lib/anonymise/resource.rb, line 12 def content if @path.nil? puts 'Path to config file is required'.colorize(:red) exit end if @path.start_with?('http') # get this from the URL via tempfile. yml_file = '' elsif File.exist?(@path) yml_file = File.open(@path) else puts 'File does not exist'.colorize(:red) exit end content = YAML.safe_load(yml_file) yml_file.close if content.empty? puts 'Config file is empty kindly check https://github.com/thirunjuguna/anonymise/blob/master/anonymise.yml' exit end content end