Class: ActiveRecord::LookML::ArrayField

Inherits:
Object
  • Object
show all
Defined in:
lib/active_record/lookml/array_field.rb

Instance Method Summary collapse

Constructor Details

#initialize(name:, values:) ⇒ ArrayField

Returns a new instance of ArrayField.



4
5
6
7
# File 'lib/active_record/lookml/array_field.rb', line 4

def initialize(name:, values:)
  @name = name
  @values = values
end

Instance Method Details

#to_lookml(indent_level: 0) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/active_record/lookml/array_field.rb', line 9

def to_lookml(indent_level: 0)
  indent = '  ' * indent_level
  lookml = "#{indent}#{@name}: [\n"
  lookml << @values.map do |value|
    "#{indent}  #{value}"
  end.join(",\n")
  lookml << "\n"
  lookml << "#{indent}]\n"
  lookml
end