Class: BqGuess::Schema
- Inherits:
-
Hash
- Object
- Hash
- BqGuess::Schema
- Defined in:
- lib/bq_guess/schema.rb
Instance Method Summary collapse
- #as_schema ⇒ Object
- #merge!(other) ⇒ Object
- #null?(key) ⇒ Boolean
- #nullable! ⇒ Object
- #repeated?(key) ⇒ Boolean
- #to_a ⇒ Object
Instance Method Details
#as_schema ⇒ Object
7 8 9 |
# File 'lib/bq_guess/schema.rb', line 7 def as_schema values.map(&:as_schema) end |
#merge!(other) ⇒ Object
11 12 13 14 |
# File 'lib/bq_guess/schema.rb', line 11 def merge!(other) _merge!(other) set_nullable(other) end |
#null?(key) ⇒ Boolean
16 17 18 |
# File 'lib/bq_guess/schema.rb', line 16 def null?(key) !key?(key) || self[key].is_a?(Fields::Null) end |
#nullable! ⇒ Object
20 21 22 |
# File 'lib/bq_guess/schema.rb', line 20 def nullable! each_value(&:nullable!) end |
#repeated?(key) ⇒ Boolean
24 25 26 |
# File 'lib/bq_guess/schema.rb', line 24 def repeated?(key) !!self[key]&.repeated? end |
#to_a ⇒ Object
28 29 30 |
# File 'lib/bq_guess/schema.rb', line 28 def to_a values.map(&:to_hash) end |