Class: Dato::Local::FieldType::Links

Inherits:
Array
  • Object
show all
Defined in:
lib/dato/local/field_type/links.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Array

#deep_stringify_keys

Class Method Details

.parse(ids, repo) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/dato/local/field_type/links.rb', line 7

def self.parse(ids, repo)
  items = if ids
            ids.map { |id| repo.find(id) }
          else
            []
          end
  new(items)
end

Instance Method Details

#to_hash(max_depth = 3, current_depth = 0) ⇒ Object



16
17
18
# File 'lib/dato/local/field_type/links.rb', line 16

def to_hash(max_depth = 3, current_depth = 0)
  map { |item| item.to_hash(max_depth, current_depth) }
end