Class: OptParseValidator::OptionsFile::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/opt_parse_validator/options_file/base.rb

Overview

Base class, #parse should be implemented in child classes

Direct Known Subclasses

JSON, YML

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Base

Returns a new instance of Base.

Parameters:

  • path (String)

    The file path of the option file



8
9
10
# File 'lib/opt_parse_validator/options_file/base.rb', line 8

def initialize(path)
  @path = path
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



5
6
7
# File 'lib/opt_parse_validator/options_file/base.rb', line 5

def path
  @path
end

Instance Method Details

#==(other) ⇒ Object



17
18
19
# File 'lib/opt_parse_validator/options_file/base.rb', line 17

def ==(other)
  path == other.path
end

#parseHash

Returns a { key: value } hash.

Returns:

  • (Hash)

    a { key: value } hash

Raises:

  • (NotImplementedError)


13
14
15
# File 'lib/opt_parse_validator/options_file/base.rb', line 13

def parse
  raise NotImplementedError
end