Class: StructuredDataToSql::Json::SchemaInferrer
- Inherits:
-
Object
- Object
- StructuredDataToSql::Json::SchemaInferrer
- Defined in:
- lib/structured_data_to_sql/json/schema_inferrer.rb
Overview
Collects TableProfiles for every table produced by shredding a file.
Instance Attribute Summary collapse
-
#profiles ⇒ Object
readonly
Returns the value of attribute profiles.
Instance Method Summary collapse
-
#initialize(raw_dates: false) ⇒ SchemaInferrer
constructor
A new instance of SchemaInferrer.
- #observe(row) ⇒ Object
Constructor Details
#initialize(raw_dates: false) ⇒ SchemaInferrer
Returns a new instance of SchemaInferrer.
134 135 136 137 |
# File 'lib/structured_data_to_sql/json/schema_inferrer.rb', line 134 def initialize(raw_dates: false) @raw_dates = raw_dates @profiles = {} end |
Instance Attribute Details
#profiles ⇒ Object (readonly)
Returns the value of attribute profiles.
132 133 134 |
# File 'lib/structured_data_to_sql/json/schema_inferrer.rb', line 132 def profiles @profiles end |
Instance Method Details
#observe(row) ⇒ Object
139 140 141 142 143 144 145 146 147 |
# File 'lib/structured_data_to_sql/json/schema_inferrer.rb', line 139 def observe(row) ( @profiles[row.table_rel] ||= TableProfile.new( row.table_rel, raw_dates: @raw_dates ) ).observe_row(row.columns) row.children.each { |child| observe(child) } end |