Sha256: e2b02a421660bd55c3e44b110a5280c5ec1d704cc805d2376f2d5c9fc7312f70
Contents?: true
Size: 691 Bytes
Versions: 10
Compression:
Stored size: 691 Bytes
Contents
# frozen_string_literal: true require "jr/cli/core_ext" module Mihari module Feed class Parser # @return [Array<Hash>, Array<Array<String>>] attr_reader :data # # @param [Array<Hash>, Array<Array<String>>] data # def initialize(data) @data = data end # # Parse data by selector # # @param [String] selector # # @return [Array<String>] # def parse(selector) parsed = data.instance_eval(selector) raise TypeError unless parsed.is_a?(Array) || parsed.is_a?(Enumerator) raise TypeError unless parsed.all?(String) parsed.to_a end end end end
Version data entries
10 entries across 10 versions & 1 rubygems