Sha256: e6b86f32b9ca14731766d02501839e7d5e4c4148637176a029e6d2df29b24807

Contents?: true

Size: 1.24 KB

Versions: 5

Compression:

Stored size: 1.24 KB

Contents

require 'howitzer/web/base_section'
require 'howitzer/meta'

module Howitzer
  module Web
    # This class uses for named sections which possible to reuse in different pages
    class Section < BaseSection
      # Provides access to meta information about entities in section
      # @return [Meta::Entry]
      def meta
        @meta ||= Meta::Entry.new(self)
      end

      class << self
        protected

        # DSL method which specifies section container selector represented by HTML element.
        # Any elements described in sections will start in this HTML element.
        # @param args [Array] original Capybara arguments. For details, see `Capybara::Node::Finders#all.
        # @param options [Array] original Capybara options. For details, see `Capybara::Node::Finders#all.
        # @raise [ArgumentError] if no arguments were passed
        # @example
        #   class MenuSection < Howitzer::Web::Section
        #     me :xpath, ".//*[@id='panel']",
        #   end
        # @!visibility public

        def me(*args, **options)
          raise ArgumentError, 'Finder arguments are missing' if args.blank?

          @default_finder_args = args
          @default_finder_options = options
          self
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
howitzer-2.6.1 lib/howitzer/web/section.rb
howitzer-2.6.0 lib/howitzer/web/section.rb
howitzer-2.5.0 lib/howitzer/web/section.rb
howitzer-2.4.0 lib/howitzer/web/section.rb
howitzer-2.3.0 lib/howitzer/web/section.rb