Class: KDomain::RawDbSchema::Load

Inherits:
Object
  • Object
show all
Includes:
KLog::Logging
Defined in:
lib/k_domain/raw_db_schema/load.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source_file) ⇒ Load

Returns a new instance of Load.



17
18
19
# File 'lib/k_domain/raw_db_schema/load.rb', line 17

def initialize(source_file)
  @source_file = source_file
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



15
16
17
# File 'lib/k_domain/raw_db_schema/load.rb', line 15

def data
  @data
end

#source_fileObject (readonly)

Returns the value of attribute source_file.



14
15
16
# File 'lib/k_domain/raw_db_schema/load.rb', line 14

def source_file
  @source_file
end

Instance Method Details

#callObject



21
22
23
24
25
26
# File 'lib/k_domain/raw_db_schema/load.rb', line 21

def call
  json = File.read(source_file)
  @raw_data = KUtil.data.json_parse(json, as: :hash_symbolized)

  @data = KDomain::Schemas::Database.new(@raw_data)
end

#to_hObject



28
29
30
31
32
# File 'lib/k_domain/raw_db_schema/load.rb', line 28

def to_h
  return nil unless defined? @raw_data

  @raw_data
end