Class: RETerm::Components::Radio

Inherits:
RETerm::Component show all
Includes:
RETerm::CDKComponent, ItemHelpers
Defined in:
lib/reterm/components/radio.rb

Overview

CDK Radio Component

Constant Summary

Constants included from LogHelpers

LogHelpers::LOG_FILE

Instance Attribute Summary

Attributes inherited from RETerm::Component

#activatable, #activate_focus, #highlight_focus, #window

Instance Method Summary collapse

Methods included from ItemHelpers

#max_item_size

Methods included from RETerm::CDKComponent

#activatable?, #activate!, #bind_key, #cdk?, #colors=, #component, #deactivate!, #draw!, #early_exit?, #erase, #escape_hit?, #init?, #init_cdk, #normal_exit?, #strip_formatting, #title_attrib=, #value

Methods inherited from RETerm::Component

#activatable?, #activate!, #activate_focus?, #cdk?, #colored?, #colors=, #deactivate!, #deactivate?, #distance_from, #extra_padding, #finalize!, #highlight_focus?, #reactivate!, #resize, #sync!, #sync_getch

Methods included from KeyBindings

#bind_key, #invoke_key_bindings, #key_bindings, #key_bound?

Methods included from LogHelpers

#logger

Methods included from EventDispatcher

#dispatch, #handle

Constructor Details

#initialize(args = {}) ⇒ Radio

Initialize the Radio component

Parameters:

  • args (Hash) (defaults to: {})

    radio params

Options Hash (args):

  • :title (String)

    title of radio

  • :items (Array<String>)

    items to populate radio with



14
15
16
17
18
# File 'lib/reterm/components/radio.rb', line 14

def initialize(args={})
  super
  @title  = args[:title] || ""
  @items  = args[:items] || []
end

Instance Method Details

#requested_colsObject



24
25
26
# File 'lib/reterm/components/radio.rb', line 24

def requested_cols
  max_item_size + 3
end

#requested_rowsObject



20
21
22
# File 'lib/reterm/components/radio.rb', line 20

def requested_rows
  @items.size
end