Class: BqGuess::Fields::Record

Inherits:
Base
  • Object
show all
Defined in:
lib/bq_guess/fields/record.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#mode, #name, #type

Instance Method Summary collapse

Methods inherited from Base

#nullable!, #nullable?, #repeated!, #repeated?, #required!, #required?

Constructor Details

#initialize(name, fields) ⇒ Record

Returns a new instance of Record.



10
11
12
13
# File 'lib/bq_guess/fields/record.rb', line 10

def initialize(name, fields)
  super(name)
  @fields = fields
end

Instance Attribute Details

#fieldsObject (readonly)

Returns the value of attribute fields.



8
9
10
# File 'lib/bq_guess/fields/record.rb', line 8

def fields
  @fields
end

Instance Method Details

#as_schemaObject



15
16
17
# File 'lib/bq_guess/fields/record.rb', line 15

def as_schema
  super.merge(fields: fields.as_schema)
end

#to_hashObject



19
20
21
# File 'lib/bq_guess/fields/record.rb', line 19

def to_hash
  super.merge(fields: fields.to_a)
end