Class: Eapi::ListMethodDefiner

Inherits:
Object
  • Object
show all
Defined in:
lib/eapi/list.rb

Constant Summary collapse

DESTRUCTIVE_SELF_OR_NIL =
[:uniq!, :compact!, :flatten!, :shuffle!, :concat, :clear, :replace, :fill, :reverse!, :rotate!, :sort!, :keep_if]
DUP_METHODS =
[:uniq, :compact, :flatten, :shuffle, :+, :-, :&, :|, :reverse, :rotate, :sort, :split, :in_groups, :in_groups_of, :from, :to]
DELEGATED_METHODS =
[
  # normal delegation
  :frozen?, :[], :[]=, :at, :fetch, :first, :last, :<<, :push, :pop, :shift, :unshift, :insert, :length, :size, :empty?, :rindex, :join, :collect, :map, :select, :values_at, :delete, :delete_at, :delete_if, :reject, :include?, :count, :sample, :bsearch, :to_json_without_active_support_encoder, :slice, :slice!, :sort_by!, :shuffle, :shuffle!,

  # for Enumerable
  :each, :each_index,

  # pose as array
  :to_ary, :*,

  # active support
  :shelljoin, :append, :prepend, :extract_options!, :to_sentence, :to_formatted_s, :to_default_s, :to_xml, :second, :third, :fourth, :fifth, :forty_two, :to_param, :to_query,

  # destructive that return selection
  :collect!, :map!, :select!, :reject!,
]

Class Method Summary collapse

Class Method Details

.finalise(klass) ⇒ Object



114
115
116
117
118
119
# File 'lib/eapi/list.rb', line 114

def self.finalise(klass)
  delegate_methods_to_list klass
  pose_as_array klass
  destructive_self_or_nil klass
  dup_methods klass
end