Class: MasterDataTool::MasterDataFile
- Inherits:
-
Object
- Object
- MasterDataTool::MasterDataFile
- Defined in:
- lib/master_data_tool/master_data_file.rb
Instance Attribute Summary collapse
-
#override_identifier ⇒ Object
readonly
Returns the value of attribute override_identifier.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#spec_name ⇒ Object
readonly
Returns the value of attribute spec_name.
-
#table_name ⇒ Object
readonly
Returns the value of attribute table_name.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #basename ⇒ Object
- #hash ⇒ Object
-
#initialize(spec_name:, table_name:, path:, override_identifier:) ⇒ MasterDataFile
constructor
A new instance of MasterDataFile.
Constructor Details
#initialize(spec_name:, table_name:, path:, override_identifier:) ⇒ MasterDataFile
Returns a new instance of MasterDataFile.
6 7 8 9 10 11 12 |
# File 'lib/master_data_tool/master_data_file.rb', line 6 def initialize(spec_name:, table_name:, path:, override_identifier:) @spec_name = spec_name @table_name = table_name @path = path @override_identifier = override_identifier freeze end |
Instance Attribute Details
#override_identifier ⇒ Object (readonly)
Returns the value of attribute override_identifier.
4 5 6 |
# File 'lib/master_data_tool/master_data_file.rb', line 4 def override_identifier @override_identifier end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
4 5 6 |
# File 'lib/master_data_tool/master_data_file.rb', line 4 def path @path end |
#spec_name ⇒ Object (readonly)
Returns the value of attribute spec_name.
4 5 6 |
# File 'lib/master_data_tool/master_data_file.rb', line 4 def spec_name @spec_name end |
#table_name ⇒ Object (readonly)
Returns the value of attribute table_name.
4 5 6 |
# File 'lib/master_data_tool/master_data_file.rb', line 4 def table_name @table_name end |
Class Method Details
.build(spec_name:, path:, override_identifier:) ⇒ Object
15 16 17 18 |
# File 'lib/master_data_tool/master_data_file.rb', line 15 def build(spec_name:, path:, override_identifier:) table_name = MasterDataTool.resolve_table_name(spec_name: spec_name, csv_path: path, override_identifier: override_identifier) new(spec_name: spec_name, table_name: table_name, path: path, override_identifier: override_identifier) end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
25 26 27 28 |
# File 'lib/master_data_tool/master_data_file.rb', line 25 def ==(other) other.class === self && other.hash == hash end |
#basename ⇒ Object
21 22 23 |
# File 'lib/master_data_tool/master_data_file.rb', line 21 def basename @path.basename end |
#hash ⇒ Object
32 33 34 |
# File 'lib/master_data_tool/master_data_file.rb', line 32 def hash [@spec_name, @table_name, @path, @override_identifier].join.hash end |