Sha256: a3b44b3d520adbb31f3019eebadd920de3c96a41891950c6a0633c75ec34ebba

Contents?: true

Size: 952 Bytes

Versions: 13

Compression:

Stored size: 952 Bytes

Contents

# frozen_string_literal: true

require 'aranha/parsers/html/item'
require 'aranha/parsers/html/item_list'
require 'eac_ruby_utils/core_ext'

module EhbrsRubyUtils
  module Bga
    module Parsers
      class Table < ::Aranha::Parsers::Html::Item
        class Options < ::Aranha::Parsers::Html::ItemList
          ITEMS_XPATH = '//div[starts-with(@id, "gameoption_") ' \
                        'and not(contains(@style, "none"))]'

          field :label, :string, './div[@class = "row-label"]/text()'
          field :value, :string, './div[@class = "row-value"]' \
                                 "//*[#{xpath_ends_with('@id', "'_displayed_value'")}]/text()"
          field :description, :string, './div[@class = "gameoption_description"]/text()'

          def items_xpath
            ITEMS_XPATH
          end

          def data
            super.reject { |item| item.fetch(:label).blank? }
          end
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
ehbrs_ruby_utils-0.44.3 lib/ehbrs_ruby_utils/bga/parsers/table/options.rb
ehbrs_ruby_utils-0.44.2 lib/ehbrs_ruby_utils/bga/parsers/table/options.rb
ehbrs_ruby_utils-0.44.1 lib/ehbrs_ruby_utils/bga/parsers/table/options.rb
ehbrs_ruby_utils-0.44.0 lib/ehbrs_ruby_utils/bga/parsers/table/options.rb
ehbrs_ruby_utils-0.41.1 lib/ehbrs_ruby_utils/bga/parsers/table/options.rb
ehbrs_ruby_utils-0.41.0 lib/ehbrs_ruby_utils/bga/parsers/table/options.rb
ehbrs_ruby_utils-0.40.0 lib/ehbrs_ruby_utils/bga/parsers/table/options.rb
ehbrs_ruby_utils-0.39.0 lib/ehbrs_ruby_utils/bga/parsers/table/options.rb
ehbrs_ruby_utils-0.38.0 lib/ehbrs_ruby_utils/bga/parsers/table/options.rb
ehbrs_ruby_utils-0.37.0 lib/ehbrs_ruby_utils/bga/parsers/table/options.rb
ehbrs_ruby_utils-0.36.1 lib/ehbrs_ruby_utils/bga/parsers/table/options.rb
ehbrs_ruby_utils-0.36.0 lib/ehbrs_ruby_utils/bga/parsers/table/options.rb
ehbrs_ruby_utils-0.35.0 lib/ehbrs_ruby_utils/bga/parsers/table/options.rb