Module: HrrRbSsh::SubclassWithPreferenceListable

Instance Method Summary collapse

Instance Method Details

#[](key) ⇒ Object



10
11
12
# File 'lib/hrr_rb_ssh/subclass_with_preference_listable.rb', line 10

def [] key
  __subclass_list__(__method__).find{ |klass| klass::NAME == key }
end

#inherited(klass) ⇒ Object



6
7
8
# File 'lib/hrr_rb_ssh/subclass_with_preference_listable.rb', line 6

def inherited klass
  @subclass_list.push klass if @subclass_list
end

#list_preferredObject



18
19
20
# File 'lib/hrr_rb_ssh/subclass_with_preference_listable.rb', line 18

def list_preferred
  __subclass_list__(__method__).select{ |klass| klass::PREFERENCE > 0 }.sort_by{ |klass| klass::PREFERENCE }.reverse.map{ |klass| klass::NAME }
end

#list_supportedObject



14
15
16
# File 'lib/hrr_rb_ssh/subclass_with_preference_listable.rb', line 14

def list_supported
  __subclass_list__(__method__).map{ |klass| klass::NAME }
end