Class: KDomain::DomainModel::Load
- Inherits:
-
Object
- Object
- KDomain::DomainModel::Load
- Includes:
- KLog::Logging
- Defined in:
- lib/k_domain/domain_model/load.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#source_file ⇒ Object
readonly
Returns the value of attribute source_file.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(source_file) ⇒ Load
constructor
A new instance of Load.
- #to_h ⇒ Object
Constructor Details
#initialize(source_file) ⇒ Load
Returns a new instance of Load.
17 18 19 |
# File 'lib/k_domain/domain_model/load.rb', line 17 def initialize(source_file) @source_file = source_file end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
15 16 17 |
# File 'lib/k_domain/domain_model/load.rb', line 15 def data @data end |
#source_file ⇒ Object (readonly)
Returns the value of attribute source_file.
14 15 16 |
# File 'lib/k_domain/domain_model/load.rb', line 14 def source_file @source_file end |
Instance Method Details
#call ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/k_domain/domain_model/load.rb', line 21 def call json = File.read(source_file) @raw_data = KUtil.data.json_parse(json, as: :hash_symbolized) # This line is slow on big datasets @data = KDomain::Schemas::MainDataset.new(@raw_data) # This line is also slow on big datasets enrichment end |
#to_h ⇒ Object
32 33 34 35 36 |
# File 'lib/k_domain/domain_model/load.rb', line 32 def to_h return nil unless defined? @raw_data @raw_data end |