Class: KDomain::RawDbSchema::Load
- Inherits:
-
Object
- Object
- KDomain::RawDbSchema::Load
- Includes:
- KLog::Logging
- Defined in:
- lib/k_domain/raw_db_schema/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/raw_db_schema/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/raw_db_schema/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/raw_db_schema/load.rb', line 14 def source_file @source_file end |
Instance Method Details
#call ⇒ Object
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_h ⇒ Object
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 |