Sha256: a9eb5c8cf73281440a64a5b31b4ff82f20c5dca31ede758432cd4f89cbd76df0
Contents?: true
Size: 1.03 KB
Versions: 53
Compression:
Stored size: 1.03 KB
Contents
module Eco::Data::Locations::NodeBase module Builder include Eco::Data::Locations::NodeBase::Parsing include Eco::Data::Locations::NodeBase::Serial include Eco::Data::Locations::NodeBase::CsvConvert include Eco::Data::Locations::NodeBase::Treeify # @param data [CSV::Table, NodeBase, Array<NodeBase>] # @return [NodeBase::Class] the Node class we can use. def node_class(data) case data when ::CSV::Table return Eco::Data::Locations::NodePlain if Eco::Data::Locations::NodePlain.csv_matches_format?(csv) return Eco::Data::Locations::NodeLevel if Eco::Data::Locations::NodeLevel.csv_matches_format?(csv) when Array return nil unless sample = data.first node_class(sample) when Eco::Data::Locations::NodeBase return nil unless data.class < Eco::Data::Locations::NodeBase data.class else raise ArgumentError, "Expecting CSV::Table. Given: #{csv.class}" unless csv.is_a?(::CSV::Table) end end end end
Version data entries
53 entries across 53 versions & 1 rubygems