Method: NotionAPI::Core#children
- Defined in:
- lib/notion_api/core.rb
#children(url_or_id = @id) ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/notion_api/core.rb', line 54 def children(url_or_id = @id) # ! retrieve the children of a block. If the block has no children, return []. If it does, return the instantiated class objects associated with each child. # ! url_or_id -> the block ID or URL : ``str`` children_ids = children_ids(url_or_id) if children_ids.empty? [] else children_class_instances = [] children_ids.each { |child| children_class_instances.push(get(child)) } children_class_instances end end |