Class: Cure::Configuration::CsvFileProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/cure/config.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(csv_handler) ⇒ DefaultFileHandler



98
99
100
# File 'lib/cure/config.rb', line 98

def initialize(csv_handler)
  @csv_handler = csv_handler
end

Instance Attribute Details

#csv_handlerDefaultFileHandler (readonly)

Returns:



78
79
80
# File 'lib/cure/config.rb', line 78

def csv_handler
  @csv_handler
end

#validTrueClass, FalseClass (readonly)

Returns:

  • (TrueClass, FalseClass)


76
77
78
# File 'lib/cure/config.rb', line 76

def valid
  @valid
end

Class Method Details

.load_file(type, obj, ref_name) ⇒ CsvFileProxy

Returns:



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/cure/config.rb', line 81

def self.load_file(type, obj, ref_name)
  handler =
    case type
    when :file
      FileHandler.new(obj, ref_name)
    when :file_contents
      FileContentsHandler.new(obj, ref_name)
    when :path, :pathname
      PathnameHandler.new(obj, ref_name)
    else
      raise "Invalid file type handler [#{type}]. Supported: [:file, :file_contents, :path, :pathname]"
    end

  new(handler)
end

Instance Method Details

#descriptionObject



102
103
104
# File 'lib/cure/config.rb', line 102

def description
  @csv_handler.description
end

#with_file(&block) ⇒ Object



106
107
108
# File 'lib/cure/config.rb', line 106

def with_file(&block)
  @csv_handler.with_file(&block)
end