Sha256: f6c277af94b6b12a158d885d18f316dd8229fed51ae4cffc566a46416182bce8
Contents?: true
Size: 811 Bytes
Versions: 8
Compression:
Stored size: 811 Bytes
Contents
module Rapa class BrowseNode # @return [Hash] attr_reader :source # @param source [Hash] def initialize(source) @source = source end # @return [Array<Rapa::BrowseNode>, nil] def children if child_sources = source.dig("Children", "BrowseNode") child_sources.map do |child_source| ::Rapa::BrowseNode.new(child_source) end end end # @return [Integer] def id source["BrowseNodeId"].to_i end # @return [String] def name source["Name"] end # @return [Rapa::BrowseNode, nil] def parent if parent_source = source.dig("Ancestors", "BrowseNode") ::Rapa::BrowseNode.new(parent_source) end end # @return [String] def title source["Title"] end end end
Version data entries
8 entries across 8 versions & 1 rubygems