Class: Cure::Configuration::FileHandler

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

Instance Attribute Summary collapse

Attributes inherited from DefaultFileHandler

#ref_name, #type

Instance Method Summary collapse

Constructor Details

#initialize(file, ref_name) ⇒ FileHandler

Returns a new instance of FileHandler.

Parameters:

  • file (File)


151
152
153
154
# File 'lib/cure/config.rb', line 151

def initialize(file, ref_name)
  super(:file, ref_name)
  @file = file
end

Instance Attribute Details

#fileFile

Returns:

  • (File)


148
149
150
# File 'lib/cure/config.rb', line 148

def file
  @file
end

Instance Method Details

#descriptionObject



163
164
165
# File 'lib/cure/config.rb', line 163

def description
  File.basename(file)
end

#with_file(&_block) ⇒ Object



156
157
158
159
160
161
# File 'lib/cure/config.rb', line 156

def with_file(&_block)
  yield @file, @ref_name

ensure
  @file&.close
end