Sha256: 06034a48e37862fc75d84dc1923d954970233bafe053a47270efd5e9496695aa

Contents?: true

Size: 937 Bytes

Versions: 81

Compression:

Stored size: 937 Bytes

Contents

# encoding: utf-8

class HighLine
  class Menu < Question
    # Represents an Item of a HighLine::Menu.
    #
    class Item
      attr_reader :name, :text, :help, :action

      #
      # @param name [String] The name that is matched against the user input
      # @param attributes [Hash] options Hash to tailor menu item to your needs
      # @option attributes text: [String] The text that displays for that
      #   choice (defaults to name)
      # @option attributes help: [String] help/hint string to be displayed.
      # @option attributes action: [Block] a block that gets called when choice
      #   is selected
      #
      def initialize(name, attributes)
        @name = name
        @text = attributes[:text] || @name
        @help = attributes[:help]
        @action = attributes[:action]
      end

      def item_help
        return {} unless help
        { name.to_s.downcase => help }
      end
    end
  end
end

Version data entries

81 entries across 67 versions & 4 rubygems

Version Path
brakeman-4.8.0 bundle/ruby/2.7.0/gems/highline-2.0.3/lib/highline/menu/item.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/brakeman-4.5.1/bundle/ruby/2.5.0/gems/highline-2.0.2/lib/highline/menu/item.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/brakeman-4.6.1/bundle/ruby/2.6.0/gems/highline-2.0.2/lib/highline/menu/item.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/brakeman-4.7.0/bundle/ruby/2.6.0/gems/highline-2.0.3/lib/highline/menu/item.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/brakeman-4.7.1/bundle/ruby/2.6.0/gems/highline-2.0.3/lib/highline/menu/item.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/brakeman-4.7.2/bundle/ruby/2.6.0/gems/highline-2.0.3/lib/highline/menu/item.rb
brakeman-4.7.2 bundle/ruby/2.6.0/gems/highline-2.0.3/lib/highline/menu/item.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/brakeman-4.7.0/bundle/ruby/2.6.0/gems/highline-2.0.3/lib/highline/menu/item.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/brakeman-4.5.1/bundle/ruby/2.5.0/gems/highline-2.0.2/lib/highline/menu/item.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/brakeman-4.6.1/bundle/ruby/2.6.0/gems/highline-2.0.2/lib/highline/menu/item.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/brakeman-4.7.1/bundle/ruby/2.6.0/gems/highline-2.0.3/lib/highline/menu/item.rb
brakeman-4.7.1 bundle/ruby/2.6.0/gems/highline-2.0.3/lib/highline/menu/item.rb
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/brakeman-4.7.0/bundle/ruby/2.6.0/gems/highline-2.0.3/lib/highline/menu/item.rb
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/brakeman-4.5.1/bundle/ruby/2.5.0/gems/highline-2.0.2/lib/highline/menu/item.rb
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/brakeman-4.6.1/bundle/ruby/2.6.0/gems/highline-2.0.2/lib/highline/menu/item.rb
brakeman-4.7.0 bundle/ruby/2.6.0/gems/highline-2.0.3/lib/highline/menu/item.rb
highline-2.0.3 lib/highline/menu/item.rb
zuora_connect_ui-0.9.0 vendor/ruby/2.6.0/gems/brakeman-4.5.1/bundle/ruby/2.5.0/gems/highline-2.0.2/lib/highline/menu/item.rb
zuora_connect_ui-0.9.0 vendor/ruby/2.6.0/gems/brakeman-4.6.1/bundle/ruby/2.6.0/gems/highline-2.0.2/lib/highline/menu/item.rb
zuora_connect_ui-0.8.3 vendor/ruby/2.6.0/gems/brakeman-4.5.1/bundle/ruby/2.5.0/gems/highline-2.0.2/lib/highline/menu/item.rb