Class: Code::Object::List
- Inherits:
-
Code::Object
- Object
- Code::Object
- Code::Object::List
- Defined in:
- lib/code/object/list.rb
Direct Known Subclasses
Constant Summary collapse
- CLASS_DOCUMENTATION =
{ name: "List", description: "stores ordered values and provides enumerable operations.", examples: [ "[1, 2, 3]", "[1, 2, 3].map((value) => { value * 2 })", "List.new([1, 2])" ] }.freeze
- INSTANCE_FUNCTIONS =
{ "[]" => { name: "[]", description: "returns the item at an index.", examples: ["[1, 2, 3][0]", "[1, 2, 3][1]", "[:a, :b][0]"] }, "at" => { name: "at", description: "returns the item at an index.", examples: ["[1, 2, 3].at(0)", "[1, 2, 3].at(1)", "[:a, :b].at(0)"] }, "get" => { name: "get", description: "returns the item at an index.", examples: ["[1, 2, 3].get(0)", "[1, 2, 3].get(1)", "[:a, :b].get(0)"] }, "fetch" => { name: "fetch", description: "returns the item at an index or nothing when missing.", examples: ["[1, 2, 3].fetch(0)", "[1, 2, 3].fetch(2)", "[1].fetch(2)"] }, "values_at" => { name: "values_at", description: "returns items at multiple indexes.", examples: [ "[1, 2, 3].values_at(0, 2)", "[:a, :b, :c].values_at(1, 2)", "[1, 2, 3].values_at(0)" ] }, "slice" => { name: "slice", description: "returns a slice from the list.", examples: [ "[1, 2, 3].slice(0)", "[1, 2, 3].slice(0, 2)", "[:a, :b, :c].slice(1, 2)" ] }, "slice!" => { name: "slice!", description: "removes and returns a slice from the list.", examples: [ "[1, 2, 3].slice!(0)", "[1, 2, 3].slice!(0, 2)", "[:a, :b, :c].slice!(1, 2)" ] }, "clear" => { name: "clear", description: "removes every item from the list and returns it.", examples: ["[1, 2, 3].clear", "[].clear", "[:a].clear"] }, "join" => { name: "join", description: "returns a string made by joining list items.", examples: [ "[1, 2, 3].join", "[1, 2, 3].join(\",\")", "[:a, :b].join(\"-\")" ] }, "sort" => { name: "sort", description: "returns a new list sorted by item values or function results.", examples: [ "[3, 1, 2].sort", "[:b, :a].sort", "[3, 1, 2].sort((x) => { x })" ] }, "sort!" => { name: "sort!", description: "sorts the list in place by item values or function results.", examples: [ "[3, 1, 2].sort!", "[:b, :a].sort!", "[3, 1, 2].sort!((x) => { x })" ] }, "<<" => { name: "<<", description: "appends an item to the list and returns it.", examples: ["[1, 2] << 3", "[] << :a", "[:a] << :b"] }, "append" => { name: "append", description: "appends an item to the list and returns it.", examples: ["[1, 2].append(3)", "[].append(:a)", "[:a].append(:b)"] }, "push" => { name: "push", description: "appends an item to the list and returns it.", examples: ["[1, 2].push(3)", "[].push(:a)", "[:a].push(:b)"] }, "prepend" => { name: "prepend", description: "prepends an item to the list and returns it.", examples: ["[2, 3].prepend(1)", "[].prepend(:a)", "[:b].prepend(:a)"] }, "insert" => { name: "insert", description: "inserts an item at an index and returns the list.", examples: [ "[1, 3].insert(1, 2)", "[:b].insert(0, :a)", "[1, 2].insert(2, 3)" ] }, "concat" => { name: "concat", description: "appends lists to the list and returns it.", examples: [ "[1].concat([2])", "[1].concat([2], [3])", "[].concat([:a])" ] }, "fill" => { name: "fill", description: "replaces list items with a value and returns the list.", examples: [ "[1, 2, 3].fill(0)", "[1, 2, 3].fill(0, 1)", "[1, 2, 3].fill(0, 1, 2)" ] }, "+" => { name: "+", description: "returns a new list with another list appended.", examples: ["[1] + [2]", "[] + [:a]", "[1, 2] + [3]"] }, "plus" => { name: "plus", description: "returns a new list with another list appended.", examples: ["[1].plus([2])", "[].plus([:a])", "[1, 2].plus([3])"] }, "-" => { name: "-", description: "returns a new list without items from another list.", examples: ["[1, 2] - [2]", "[:a, :b] - [:a]", "[1, 2] - []"] }, "minus" => { name: "minus", description: "returns a new list without items from another list.", examples: [ "[1, 2].minus([2])", "[:a, :b].minus([:a])", "[1, 2].minus([])" ] }, "any?" => { name: "any?", description: "returns whether any item is present or matches a function or class.", examples: [ "[1, 2, 3].any?", "[1, 2, 3].any?((x) => { x > 2 })", "[].any?" ] }, "detect" => { name: "detect", description: "returns the first item matched by a function or class.", examples: [ "[1, 2, 3].detect((x) => { x > 1 })", "[1, 2, 3].detect(Integer)", "[1, 2, 3].detect((x) => { x > 3 })" ] }, "index" => { name: "index", description: "returns the index of an item or first item matched by a function or class.", examples: [ "[:a, :b].index(:b)", "[1, 2, 3].index((x) => { x > 1 })", "[:a].index(:missing)" ] }, "find_index" => { name: "find_index", description: "returns the index of an item or first item matched by a function or class.", examples: [ "[:a, :b].find_index(:b)", "[1, 2, 3].find_index((x) => { x > 1 })", "[:a].find_index(:missing)" ] }, "right_index" => { name: "right_index", description: "returns the last index of an item or of an item matched by a function or class.", examples: [ "[:a, :b, :a].right_index(:a)", "[1, 2, 3].right_index((x) => { x > 1 })", "[:a].right_index(:missing)" ] }, "each" => { name: "each", description: "calls a function or class for each item and returns the list.", examples: [ "[1, 2, 3].each((x) => { x })", "[:a, :b].each((x) => { x })", "[].each((x) => { x })" ] }, "each_index" => { name: "each_index", description: "calls a function for each item index and returns the list.", examples: [ "[1, 2, 3].each_index((i) => { i })", "[:a, :b].each_index((i) => { i })", "[].each_index((i) => { i })" ] }, "first" => { name: "first", description: "returns the first item or first items.", examples: ["[1, 2, 3].first", "[1, 2, 3].first(2)", "[].first"] }, "second" => { name: "second", description: "returns the second item.", examples: ["[1, 2, 3].second", "[:a, :b].second", "[1].second"] }, "third" => { name: "third", description: "returns the third item.", examples: ["[1, 2, 3].third", "[:a, :b, :c].third", "[1].third"] }, "fourth" => { name: "fourth", description: "returns the fourth item.", examples: [ "[1, 2, 3, 4].fourth", "(1..5).to_list.fourth", "[1].fourth" ] }, "fifth" => { name: "fifth", description: "returns the fifth item.", examples: [ "[1, 2, 3, 4, 5].fifth", "(1..6).to_list.fifth", "[1].fifth" ] }, "sixth" => { name: "sixth", description: "returns the sixth item.", examples: [ "(1..6).to_list.sixth", "(1..7).to_list.sixth", "[1].sixth" ] }, "seventh" => { name: "seventh", description: "returns the seventh item.", examples: [ "(1..7).to_list.seventh", "(1..8).to_list.seventh", "[1].seventh" ] }, "eighth" => { name: "eighth", description: "returns the eighth item.", examples: [ "(1..8).to_list.eighth", "(1..9).to_list.eighth", "[1].eighth" ] }, "ninth" => { name: "ninth", description: "returns the ninth item.", examples: [ "(1..9).to_list.ninth", "(1..10).to_list.ninth", "[1].ninth" ] }, "tenth" => { name: "tenth", description: "returns the tenth item.", examples: [ "(1..10).to_list.tenth", "(1..11).to_list.tenth", "[1].tenth" ] }, "map" => { name: "map", description: "returns a new list with each item transformed by a function or class.", examples: [ "[1, 2, 3].map(Integer)", "[:1, :2].map(Integer)", "[1, 2].map((value) => { value + 1 })" ] }, "sample" => { name: "sample", description: "returns a random item or random items from the list.", examples: ["[1, 2, 3].sample", "[1, 2, 3].sample(2)", "[:a].sample"] }, "shuffle" => { name: "shuffle", description: "returns a new list with items shuffled.", examples: ["[1, 2, 3].shuffle", "[:a, :b].shuffle", "[].shuffle"] }, "shuffle!" => { name: "shuffle!", description: "shuffles the list in place and returns it.", examples: ["[1, 2, 3].shuffle!", "[:a, :b].shuffle!", "[].shuffle!"] }, "flatten" => { name: "flatten", description: "returns a new list with nested lists flattened.", examples: [ "[1, [2, 3]].flatten", "[[1], [2]].flatten", "[1, 2].flatten" ] }, "delete" => { name: "delete", description: "removes matching items from the list and returns the removed value.", examples: [ "[1, 2, 2].delete(2)", "[:a, :b].delete(:a)", "[1].delete(2)" ] }, "delete_at" => { name: "delete_at", description: "removes and returns the item at an index.", examples: [ "[1, 2, 3].delete_at(1)", "[:a, :b].delete_at(0)", "[1].delete_at(2)" ] }, "delete_if" => { name: "delete_if", description: "removes items matched by a function or class and returns the list.", examples: [ "[1, 2, 3].delete_if((x) => { x > 1 })", "[:a, :b].delete_if((x) => { x == :a })", "[].delete_if((x) => { x })" ] }, "keep_if" => { name: "keep_if", description: "keeps items matched by a function or class and returns the list.", examples: [ "[1, 2, 3].keep_if((x) => { x > 1 })", "[:a, :b].keep_if((x) => { x == :a })", "[].keep_if((x) => { x })" ] }, "pop" => { name: "pop", description: "returns the last item or last items without mutating the list.", examples: ["[1, 2, 3].pop", "[1, 2, 3].pop(2)", "[].pop"] }, "pop!" => { name: "pop!", description: "removes and returns the last item or last items.", examples: ["[1, 2, 3].pop!", "[1, 2, 3].pop!(2)", "[].pop!"] }, "shift" => { name: "shift", description: "removes and returns the first item or first items.", examples: ["[1, 2, 3].shift", "[1, 2, 3].shift(2)", "[].shift"] }, "include?" => { name: "include?", description: "returns whether the list includes an item.", examples: [ "[1, 2, 3].include?(2)", "[:a, :b].include?(:c)", "[].include?(1)" ] }, "member?" => { name: "member?", description: "returns whether the list includes an item.", examples: [ "[1, 2, 3].member?(2)", "[:a, :b].member?(:c)", "[].member?(1)" ] }, "last" => { name: "last", description: "returns the last item.", examples: ["[1, 2, 3].last", "[:a, :b].last", "[].last"] }, "take" => { name: "take", description: "returns the first items from the list.", examples: ["[1, 2, 3].take(2)", "[1, 2, 3].take(0)", "[].take(2)"] }, "drop" => { name: "drop", description: "returns the list after dropping leading items.", examples: ["[1, 2, 3].drop(1)", "[1, 2, 3].drop(3)", "[].drop(1)"] }, "drop_while" => { name: "drop_while", description: "drops leading items while a function or class matches.", examples: [ "[1, 2, 3].drop_while((x) => { x < 3 })", "[1, 2, 3].drop_while((x) => { x < 1 })", "[].drop_while((x) => { x })" ] }, "take_while" => { name: "take_while", description: "takes leading items while a function or class matches.", examples: [ "[1, 2, 3].take_while((x) => { x < 3 })", "[1, 2, 3].take_while((x) => { x < 1 })", "[].take_while((x) => { x })" ] }, "zip" => { name: "zip", description: "returns a list by zipping items with other lists.", examples: ["[1, 2].zip([3, 4])", "[:a, :b].zip([1, 2])", "[].zip([])"] }, "map!" => { name: "map!", description: "transforms each item in place and returns the list.", examples: [ "[1, 2, 3].map!((x) => { x + 1 })", "[:1, :2].map!(Integer)", "[].map!((x) => { x })" ] }, "flat_map" => { name: "flat_map", description: "maps each item and flattens the result one level.", examples: [ "[1, 2].flat_map((x) => { [x, x] })", "[[1], [2]].flat_map((x) => { x })", "[].flat_map((x) => { [x] })" ] }, "max" => { name: "max", description: "returns the maximum item.", examples: ["[1, 3, 2].max", "[:a, :b].max", "[].max"] }, "maximum" => { name: "maximum", description: "returns the maximum item.", examples: ["[1, 3, 2].maximum", "[:a, :b].maximum", "[].maximum"] }, "minimum" => { name: "minimum", description: "returns the minimum item.", examples: ["[1, 3, 2].minimum", "[:a, :b].minimum", "[].minimum"] }, "minimum_maximum" => { name: "minimum_maximum", description: "returns the minimum and maximum items.", examples: [ "[1, 3, 2].minimum_maximum", "[:a, :b].minimum_maximum", "[].minimum_maximum" ] }, "none?" => { name: "none?", description: "returns whether no items are present or match a function or class.", examples: [ "[].none?", "[1, 2, 3].none?((x) => { x > 3 })", "[1, 2, 3].none?((x) => { x > 1 })" ] }, "all?" => { name: "all?", description: "returns whether all items are present or match a function or class.", examples: [ "[1, 2, 3].all?", "[1, 2, 3].all?((x) => { x > 0 })", "[1, 2, 3].all?((x) => { x > 1 })" ] }, "reduce" => { name: "reduce", description: "combines list items with a function.", examples: [ "[1, 2, 3].reduce((sum, x) => { sum + x })", "[1, 2, 3].reduce((sum, x) => { sum * x })", "[:a, :b].reduce((left, right) => { left + right })" ] }, "group" => { name: "group", description: "returns a dictionary grouping items by a function result or class match.", examples: [ "[1, 2, 3].group((x) => { x.even? })", "[:a, :b].group(String)", "[].group((x) => { x })" ] }, "partition" => { name: "partition", description: "splits items into matching and non-matching lists.", examples: [ "[1, 2, 3].partition((x) => { x > 1 })", "[:a, :b].partition((x) => { x == :a })", "[].partition((x) => { x })" ] }, "cycle" => { name: "cycle", description: "returns cycled items or calls a function for each cycled item.", examples: [ "[1, 2].cycle(2)", "[1, 2].cycle(2, (x) => { x })", "[:a].cycle(3, (x) => { x })" ] }, "transpose" => { name: "transpose", description: "returns rows and columns swapped.", examples: [ "[[1, 2], [3, 4]].transpose", "[[:a, :b], [:c, :d]].transpose", "[].transpose" ] }, "combination" => { name: "combination", description: "returns combinations of list items.", examples: [ "[1, 2, 3].combination(2)", "[:a, :b, :c].combination(1)", "[].combination(2)" ] }, "permutation" => { name: "permutation", description: "returns permutations of list items.", examples: [ "[1, 2, 3].permutation(2)", "[:a, :b].permutation", "[].permutation" ] }, "product" => { name: "product", description: "returns cartesian products with other lists.", examples: [ "[1, 2].product([3, 4])", "[:a, :b].product([1])", "[].product([1, 2])" ] }, "repeated_combination" => { name: "repeated_combination", description: "returns repeated combinations of list items.", examples: [ "[1, 2].repeated_combination(2)", "[:a, :b].repeated_combination(3)", "[].repeated_combination(2)" ] }, "repeated_permutation" => { name: "repeated_permutation", description: "returns repeated permutations of list items.", examples: [ "[1, 2].repeated_permutation(2)", "[:a, :b].repeated_permutation(3)", "[].repeated_permutation(2)" ] }, "reverse" => { name: "reverse", description: "returns a new list with items in reverse order.", examples: ["[1, 2, 3].reverse", "[:a, :b].reverse", "[].reverse"] }, "reverse!" => { name: "reverse!", description: "reverses the list in place and returns it.", examples: ["[1, 2, 3].reverse!", "[:a, :b].reverse!", "[].reverse!"] }, "reverse_each" => { name: "reverse_each", description: "calls a function for each item in reverse order.", examples: [ "[1, 2, 3].reverse_each((x) => { x })", "[:a, :b].reverse_each((x) => { x })", "[].reverse_each((x) => { x })" ] }, "rotate" => { name: "rotate", description: "returns a new list rotated by an offset.", examples: [ "[1, 2, 3].rotate", "[1, 2, 3].rotate(2)", "[:a, :b].rotate" ] }, "rotate!" => { name: "rotate!", description: "rotates the list in place and returns it.", examples: [ "[1, 2, 3].rotate!", "[1, 2, 3].rotate!(2)", "[:a, :b].rotate!" ] }, "union" => { name: "union", description: "returns a list containing unique items from each list.", examples: [ "[1, 2].union([2, 3])", "[:a].union([:b])", "[].union([1])" ] }, "intersection" => { name: "intersection", description: "returns items present in every list.", examples: [ "[1, 2].intersection([2, 3])", "[:a, :b].intersection([:b])", "[].intersection([1])" ] }, "difference" => { name: "difference", description: "returns items not present in another list.", examples: [ "[1, 2].difference([2])", "[:a, :b].difference([:a])", "[].difference([1])" ] }, "intersect?" => { name: "intersect?", description: "returns whether the list shares items with another list.", examples: [ "[1, 2].intersect?([2, 3])", "[:a].intersect?([:b])", "[].intersect?([1])" ] }, "associate" => { name: "associate", description: "returns the first nested list whose first item matches a value.", examples: [ "[[:a, 1], [:b, 2]].associate(:a)", "[[1, :a], [2, :b]].associate(2)", "[[:a, 1]].associate(:missing)" ] }, "right_associate" => { name: "right_associate", description: "returns the first nested list whose second item matches a value.", examples: [ "[[1, :a], [2, :b]].right_associate(:a)", "[[:a, 1], [:b, 2]].right_associate(2)", "[[:a, 1]].right_associate(:missing)" ] }, "select" => { name: "select", description: "returns items matched by a function or class.", examples: [ "[1, 2, 3].select((x) => { x > 1 })", "[1, :a, 2].select(Integer)", "[].select((x) => { x })" ] }, "filter" => { name: "filter", description: "returns items matched by a function or class.", examples: [ "[1, 2, 3].filter((x) => { x > 1 })", "[1, :a, 2].filter(Integer)", "[].filter((x) => { x })" ] }, "select!" => { name: "select!", description: "keeps items matched by a function or class and returns the list.", examples: [ "[1, 2, 3].select!((x) => { x > 1 })", "[1, :a, 2].select!(Integer)", "[].select!((x) => { x })" ] }, "filter!" => { name: "filter!", description: "keeps items matched by a function or class and returns the list.", examples: [ "[1, 2, 3].filter!((x) => { x > 1 })", "[1, :a, 2].filter!(Integer)", "[].filter!((x) => { x })" ] }, "compact" => { name: "compact", description: "returns a new list without nothing values or matched items.", examples: [ "[1, nothing, 2].compact", "[1, :a, 2].compact(String)", "[1, 2, 3].compact((x) => { x > 1 })" ] }, "compact!" => { name: "compact!", description: "removes nothing values or matched items in place and returns the list.", examples: [ "[1, nothing, 2].compact!", "[1, :a, 2].compact!(String)", "[1, 2, 3].compact!((x) => { x > 1 })" ] }, "reject" => { name: "reject", description: "returns items not matched by a function or class.", examples: [ "[1, 2, 3].reject((x) => { x > 1 })", "[1, :a, 2].reject(Integer)", "[].reject((x) => { x })" ] }, "reject!" => { name: "reject!", description: "removes items matched by a function or class and returns the list.", examples: [ "[1, 2, 3].reject!((x) => { x > 1 })", "[1, :a, 2].reject!(Integer)", "[].reject!((x) => { x })" ] }, "size" => { name: "size", description: "returns the number of items in the list.", examples: ["[1, 2, 3].size", "[].size", "[:a].size"] }, "length" => { name: "length", description: "returns the number of items in the list.", examples: ["[1, 2, 3].length", "[].length", "[:a].length"] }, "empty?" => { name: "empty?", description: "returns whether the list has no items.", examples: ["[].empty?", "[1].empty?", "[:a, :b].empty?"] }, "count" => { name: "count", description: "returns the number of items or matching items.", examples: [ "[1, 2, 3].count", "[1, 2, 2].count((x) => { x == 2 })", "[1, 2, 3].count((x) => { x > 1 })" ] }, "sum" => { name: "sum", description: "returns the sum of list items.", examples: ["[1, 2, 3].sum", "[].sum", "[10, 20].sum"] }, "tally" => { name: "tally", description: "returns a dictionary counting each item.", examples: ["[:a, :b, :a].tally", "[1, 1, 2].tally", "[].tally"] }, "entries" => { name: "entries", description: "returns the list itself.", examples: ["[1, 2, 3].entries", "[].entries", "[:a].entries"] }, "to_dictionary" => { name: "to_dictionary", description: "converts the list to a dictionary using entry pairs or indexes.", examples: [ "[[:a, 1], [:b, 2]].to_dictionary", "[\"a\", \"b\"].to_dictionary", "[].to_dictionary" ] }, "uniq" => { name: "uniq", description: "returns a new list with duplicate items removed.", examples: [ "[1, 1, 2].uniq", "[:a, :a].uniq", "[1, 2, 3].uniq((x) => { x > 1 })" ] }, "sort_by!" => { name: "sort_by!", description: "sorts the list in place by function results.", examples: [ "[3, 1, 2].sort_by!((x) => { x })", "[:bb, :a].sort_by!((x) => { x.size })", "[].sort_by!((x) => { x })" ] }, "uniq!" => { name: "uniq!", description: "removes duplicate items in place and returns the list.", examples: [ "[1, 1, 2].uniq!", "[:a, :a].uniq!", "[1, 2, 3].uniq!((x) => { x > 1 })" ] }, "eleventh" => { name: "eleventh", description: "returns the eleventh item.", examples: [ "(1..11).to_list.eleventh", "(1..12).to_list.eleventh", "[].eleventh" ] }, "twelfth" => { name: "twelfth", description: "returns the twelfth item.", examples: [ "(1..12).to_list.twelfth", "(1..13).to_list.twelfth", "[].twelfth" ] }, "thirteenth" => { name: "thirteenth", description: "returns the thirteenth item.", examples: [ "(1..13).to_list.thirteenth", "(1..14).to_list.thirteenth", "[].thirteenth" ] }, "fourteenth" => { name: "fourteenth", description: "returns the fourteenth item.", examples: [ "(1..14).to_list.fourteenth", "(1..15).to_list.fourteenth", "[].fourteenth" ] }, "fifteenth" => { name: "fifteenth", description: "returns the fifteenth item.", examples: [ "(1..15).to_list.fifteenth", "(1..16).to_list.fifteenth", "[].fifteenth" ] }, "sixteenth" => { name: "sixteenth", description: "returns the sixteenth item.", examples: [ "(1..16).to_list.sixteenth", "(1..17).to_list.sixteenth", "[].sixteenth" ] }, "seventeenth" => { name: "seventeenth", description: "returns the seventeenth item.", examples: [ "(1..17).to_list.seventeenth", "(1..18).to_list.seventeenth", "[].seventeenth" ] }, "eighteenth" => { name: "eighteenth", description: "returns the eighteenth item.", examples: [ "(1..18).to_list.eighteenth", "(1..19).to_list.eighteenth", "[].eighteenth" ] }, "nineteenth" => { name: "nineteenth", description: "returns the nineteenth item.", examples: [ "(1..19).to_list.nineteenth", "(1..20).to_list.nineteenth", "[].nineteenth" ] }, "twentieth" => { name: "twentieth", description: "returns the twentieth item.", examples: [ "(1..20).to_list.twentieth", "(1..21).to_list.twentieth", "[].twentieth" ] }, "twenty_first" => { name: "twenty_first", description: "returns the twenty first item.", examples: [ "(1..21).to_list.twenty_first", "(1..22).to_list.twenty_first", "[].twenty_first" ] }, "twenty_second" => { name: "twenty_second", description: "returns the twenty second item.", examples: [ "(1..22).to_list.twenty_second", "(1..23).to_list.twenty_second", "[].twenty_second" ] }, "twenty_third" => { name: "twenty_third", description: "returns the twenty third item.", examples: [ "(1..23).to_list.twenty_third", "(1..24).to_list.twenty_third", "[].twenty_third" ] }, "twenty_fourth" => { name: "twenty_fourth", description: "returns the twenty fourth item.", examples: [ "(1..24).to_list.twenty_fourth", "(1..25).to_list.twenty_fourth", "[].twenty_fourth" ] }, "twenty_fifth" => { name: "twenty_fifth", description: "returns the twenty fifth item.", examples: [ "(1..25).to_list.twenty_fifth", "(1..26).to_list.twenty_fifth", "[].twenty_fifth" ] }, "twenty_sixth" => { name: "twenty_sixth", description: "returns the twenty sixth item.", examples: [ "(1..26).to_list.twenty_sixth", "(1..27).to_list.twenty_sixth", "[].twenty_sixth" ] }, "twenty_seventh" => { name: "twenty_seventh", description: "returns the twenty seventh item.", examples: [ "(1..27).to_list.twenty_seventh", "(1..28).to_list.twenty_seventh", "[].twenty_seventh" ] }, "twenty_eighth" => { name: "twenty_eighth", description: "returns the twenty eighth item.", examples: [ "(1..28).to_list.twenty_eighth", "(1..29).to_list.twenty_eighth", "[].twenty_eighth" ] }, "twenty_ninth" => { name: "twenty_ninth", description: "returns the twenty ninth item.", examples: [ "(1..29).to_list.twenty_ninth", "(1..30).to_list.twenty_ninth", "[].twenty_ninth" ] }, "thirtieth" => { name: "thirtieth", description: "returns the thirtieth item.", examples: [ "(1..30).to_list.thirtieth", "(1..31).to_list.thirtieth", "[].thirtieth" ] }, "thirty_first" => { name: "thirty_first", description: "returns the thirty first item.", examples: [ "(1..31).to_list.thirty_first", "(1..32).to_list.thirty_first", "[].thirty_first" ] }, "thirty_second" => { name: "thirty_second", description: "returns the thirty second item.", examples: [ "(1..32).to_list.thirty_second", "(1..33).to_list.thirty_second", "[].thirty_second" ] }, "thirty_third" => { name: "thirty_third", description: "returns the thirty third item.", examples: [ "(1..33).to_list.thirty_third", "(1..34).to_list.thirty_third", "[].thirty_third" ] }, "thirty_fourth" => { name: "thirty_fourth", description: "returns the thirty fourth item.", examples: [ "(1..34).to_list.thirty_fourth", "(1..35).to_list.thirty_fourth", "[].thirty_fourth" ] }, "thirty_fifth" => { name: "thirty_fifth", description: "returns the thirty fifth item.", examples: [ "(1..35).to_list.thirty_fifth", "(1..36).to_list.thirty_fifth", "[].thirty_fifth" ] }, "thirty_sixth" => { name: "thirty_sixth", description: "returns the thirty sixth item.", examples: [ "(1..36).to_list.thirty_sixth", "(1..37).to_list.thirty_sixth", "[].thirty_sixth" ] }, "thirty_seventh" => { name: "thirty_seventh", description: "returns the thirty seventh item.", examples: [ "(1..37).to_list.thirty_seventh", "(1..38).to_list.thirty_seventh", "[].thirty_seventh" ] }, "thirty_eighth" => { name: "thirty_eighth", description: "returns the thirty eighth item.", examples: [ "(1..38).to_list.thirty_eighth", "(1..39).to_list.thirty_eighth", "[].thirty_eighth" ] }, "thirty_ninth" => { name: "thirty_ninth", description: "returns the thirty ninth item.", examples: [ "(1..39).to_list.thirty_ninth", "(1..40).to_list.thirty_ninth", "[].thirty_ninth" ] }, "fortieth" => { name: "fortieth", description: "returns the fortieth item.", examples: [ "(1..40).to_list.fortieth", "(1..41).to_list.fortieth", "[].fortieth" ] }, "forty_first" => { name: "forty_first", description: "returns the forty first item.", examples: [ "(1..41).to_list.forty_first", "(1..42).to_list.forty_first", "[].forty_first" ] }, "forty_second" => { name: "forty_second", description: "returns the forty second item.", examples: [ "(1..42).to_list.forty_second", "(1..43).to_list.forty_second", "[].forty_second" ] }, "forty_third" => { name: "forty_third", description: "returns the forty third item.", examples: [ "(1..43).to_list.forty_third", "(1..44).to_list.forty_third", "[].forty_third" ] }, "forty_fourth" => { name: "forty_fourth", description: "returns the forty fourth item.", examples: [ "(1..44).to_list.forty_fourth", "(1..45).to_list.forty_fourth", "[].forty_fourth" ] }, "forty_fifth" => { name: "forty_fifth", description: "returns the forty fifth item.", examples: [ "(1..45).to_list.forty_fifth", "(1..46).to_list.forty_fifth", "[].forty_fifth" ] }, "forty_sixth" => { name: "forty_sixth", description: "returns the forty sixth item.", examples: [ "(1..46).to_list.forty_sixth", "(1..47).to_list.forty_sixth", "[].forty_sixth" ] }, "forty_seventh" => { name: "forty_seventh", description: "returns the forty seventh item.", examples: [ "(1..47).to_list.forty_seventh", "(1..48).to_list.forty_seventh", "[].forty_seventh" ] }, "forty_eighth" => { name: "forty_eighth", description: "returns the forty eighth item.", examples: [ "(1..48).to_list.forty_eighth", "(1..49).to_list.forty_eighth", "[].forty_eighth" ] }, "forty_ninth" => { name: "forty_ninth", description: "returns the forty ninth item.", examples: [ "(1..49).to_list.forty_ninth", "(1..50).to_list.forty_ninth", "[].forty_ninth" ] }, "fiftieth" => { name: "fiftieth", description: "returns the fiftieth item.", examples: [ "(1..50).to_list.fiftieth", "(1..51).to_list.fiftieth", "[].fiftieth" ] }, "fifty_first" => { name: "fifty_first", description: "returns the fifty first item.", examples: [ "(1..51).to_list.fifty_first", "(1..52).to_list.fifty_first", "[].fifty_first" ] }, "fifty_second" => { name: "fifty_second", description: "returns the fifty second item.", examples: [ "(1..52).to_list.fifty_second", "(1..53).to_list.fifty_second", "[].fifty_second" ] }, "fifty_third" => { name: "fifty_third", description: "returns the fifty third item.", examples: [ "(1..53).to_list.fifty_third", "(1..54).to_list.fifty_third", "[].fifty_third" ] }, "fifty_fourth" => { name: "fifty_fourth", description: "returns the fifty fourth item.", examples: [ "(1..54).to_list.fifty_fourth", "(1..55).to_list.fifty_fourth", "[].fifty_fourth" ] }, "fifty_fifth" => { name: "fifty_fifth", description: "returns the fifty fifth item.", examples: [ "(1..55).to_list.fifty_fifth", "(1..56).to_list.fifty_fifth", "[].fifty_fifth" ] }, "fifty_sixth" => { name: "fifty_sixth", description: "returns the fifty sixth item.", examples: [ "(1..56).to_list.fifty_sixth", "(1..57).to_list.fifty_sixth", "[].fifty_sixth" ] }, "fifty_seventh" => { name: "fifty_seventh", description: "returns the fifty seventh item.", examples: [ "(1..57).to_list.fifty_seventh", "(1..58).to_list.fifty_seventh", "[].fifty_seventh" ] }, "fifty_eighth" => { name: "fifty_eighth", description: "returns the fifty eighth item.", examples: [ "(1..58).to_list.fifty_eighth", "(1..59).to_list.fifty_eighth", "[].fifty_eighth" ] }, "fifty_ninth" => { name: "fifty_ninth", description: "returns the fifty ninth item.", examples: [ "(1..59).to_list.fifty_ninth", "(1..60).to_list.fifty_ninth", "[].fifty_ninth" ] }, "sixtieth" => { name: "sixtieth", description: "returns the sixtieth item.", examples: [ "(1..60).to_list.sixtieth", "(1..61).to_list.sixtieth", "[].sixtieth" ] }, "sixty_first" => { name: "sixty_first", description: "returns the sixty first item.", examples: [ "(1..61).to_list.sixty_first", "(1..62).to_list.sixty_first", "[].sixty_first" ] }, "sixty_second" => { name: "sixty_second", description: "returns the sixty second item.", examples: [ "(1..62).to_list.sixty_second", "(1..63).to_list.sixty_second", "[].sixty_second" ] }, "sixty_third" => { name: "sixty_third", description: "returns the sixty third item.", examples: [ "(1..63).to_list.sixty_third", "(1..64).to_list.sixty_third", "[].sixty_third" ] }, "sixty_fourth" => { name: "sixty_fourth", description: "returns the sixty fourth item.", examples: [ "(1..64).to_list.sixty_fourth", "(1..65).to_list.sixty_fourth", "[].sixty_fourth" ] }, "sixty_fifth" => { name: "sixty_fifth", description: "returns the sixty fifth item.", examples: [ "(1..65).to_list.sixty_fifth", "(1..66).to_list.sixty_fifth", "[].sixty_fifth" ] }, "sixty_sixth" => { name: "sixty_sixth", description: "returns the sixty sixth item.", examples: [ "(1..66).to_list.sixty_sixth", "(1..67).to_list.sixty_sixth", "[].sixty_sixth" ] }, "sixty_seventh" => { name: "sixty_seventh", description: "returns the sixty seventh item.", examples: [ "(1..67).to_list.sixty_seventh", "(1..68).to_list.sixty_seventh", "[].sixty_seventh" ] }, "sixty_eighth" => { name: "sixty_eighth", description: "returns the sixty eighth item.", examples: [ "(1..68).to_list.sixty_eighth", "(1..69).to_list.sixty_eighth", "[].sixty_eighth" ] }, "sixty_ninth" => { name: "sixty_ninth", description: "returns the sixty ninth item.", examples: [ "(1..69).to_list.sixty_ninth", "(1..70).to_list.sixty_ninth", "[].sixty_ninth" ] }, "seventieth" => { name: "seventieth", description: "returns the seventieth item.", examples: [ "(1..70).to_list.seventieth", "(1..71).to_list.seventieth", "[].seventieth" ] }, "seventy_first" => { name: "seventy_first", description: "returns the seventy first item.", examples: [ "(1..71).to_list.seventy_first", "(1..72).to_list.seventy_first", "[].seventy_first" ] }, "seventy_second" => { name: "seventy_second", description: "returns the seventy second item.", examples: [ "(1..72).to_list.seventy_second", "(1..73).to_list.seventy_second", "[].seventy_second" ] }, "seventy_third" => { name: "seventy_third", description: "returns the seventy third item.", examples: [ "(1..73).to_list.seventy_third", "(1..74).to_list.seventy_third", "[].seventy_third" ] }, "seventy_fourth" => { name: "seventy_fourth", description: "returns the seventy fourth item.", examples: [ "(1..74).to_list.seventy_fourth", "(1..75).to_list.seventy_fourth", "[].seventy_fourth" ] }, "seventy_fifth" => { name: "seventy_fifth", description: "returns the seventy fifth item.", examples: [ "(1..75).to_list.seventy_fifth", "(1..76).to_list.seventy_fifth", "[].seventy_fifth" ] }, "seventy_sixth" => { name: "seventy_sixth", description: "returns the seventy sixth item.", examples: [ "(1..76).to_list.seventy_sixth", "(1..77).to_list.seventy_sixth", "[].seventy_sixth" ] }, "seventy_seventh" => { name: "seventy_seventh", description: "returns the seventy seventh item.", examples: [ "(1..77).to_list.seventy_seventh", "(1..78).to_list.seventy_seventh", "[].seventy_seventh" ] }, "seventy_eighth" => { name: "seventy_eighth", description: "returns the seventy eighth item.", examples: [ "(1..78).to_list.seventy_eighth", "(1..79).to_list.seventy_eighth", "[].seventy_eighth" ] }, "seventy_ninth" => { name: "seventy_ninth", description: "returns the seventy ninth item.", examples: [ "(1..79).to_list.seventy_ninth", "(1..80).to_list.seventy_ninth", "[].seventy_ninth" ] }, "eightieth" => { name: "eightieth", description: "returns the eightieth item.", examples: [ "(1..80).to_list.eightieth", "(1..81).to_list.eightieth", "[].eightieth" ] }, "eighty_first" => { name: "eighty_first", description: "returns the eighty first item.", examples: [ "(1..81).to_list.eighty_first", "(1..82).to_list.eighty_first", "[].eighty_first" ] }, "eighty_second" => { name: "eighty_second", description: "returns the eighty second item.", examples: [ "(1..82).to_list.eighty_second", "(1..83).to_list.eighty_second", "[].eighty_second" ] }, "eighty_third" => { name: "eighty_third", description: "returns the eighty third item.", examples: [ "(1..83).to_list.eighty_third", "(1..84).to_list.eighty_third", "[].eighty_third" ] }, "eighty_fourth" => { name: "eighty_fourth", description: "returns the eighty fourth item.", examples: [ "(1..84).to_list.eighty_fourth", "(1..85).to_list.eighty_fourth", "[].eighty_fourth" ] }, "eighty_fifth" => { name: "eighty_fifth", description: "returns the eighty fifth item.", examples: [ "(1..85).to_list.eighty_fifth", "(1..86).to_list.eighty_fifth", "[].eighty_fifth" ] }, "eighty_sixth" => { name: "eighty_sixth", description: "returns the eighty sixth item.", examples: [ "(1..86).to_list.eighty_sixth", "(1..87).to_list.eighty_sixth", "[].eighty_sixth" ] }, "eighty_seventh" => { name: "eighty_seventh", description: "returns the eighty seventh item.", examples: [ "(1..87).to_list.eighty_seventh", "(1..88).to_list.eighty_seventh", "[].eighty_seventh" ] }, "eighty_eighth" => { name: "eighty_eighth", description: "returns the eighty eighth item.", examples: [ "(1..88).to_list.eighty_eighth", "(1..89).to_list.eighty_eighth", "[].eighty_eighth" ] }, "eighty_ninth" => { name: "eighty_ninth", description: "returns the eighty ninth item.", examples: [ "(1..89).to_list.eighty_ninth", "(1..90).to_list.eighty_ninth", "[].eighty_ninth" ] }, "ninetieth" => { name: "ninetieth", description: "returns the ninetieth item.", examples: [ "(1..90).to_list.ninetieth", "(1..91).to_list.ninetieth", "[].ninetieth" ] }, "ninety_first" => { name: "ninety_first", description: "returns the ninety first item.", examples: [ "(1..91).to_list.ninety_first", "(1..92).to_list.ninety_first", "[].ninety_first" ] }, "ninety_second" => { name: "ninety_second", description: "returns the ninety second item.", examples: [ "(1..92).to_list.ninety_second", "(1..93).to_list.ninety_second", "[].ninety_second" ] }, "ninety_third" => { name: "ninety_third", description: "returns the ninety third item.", examples: [ "(1..93).to_list.ninety_third", "(1..94).to_list.ninety_third", "[].ninety_third" ] }, "ninety_fourth" => { name: "ninety_fourth", description: "returns the ninety fourth item.", examples: [ "(1..94).to_list.ninety_fourth", "(1..95).to_list.ninety_fourth", "[].ninety_fourth" ] }, "ninety_fifth" => { name: "ninety_fifth", description: "returns the ninety fifth item.", examples: [ "(1..95).to_list.ninety_fifth", "(1..96).to_list.ninety_fifth", "[].ninety_fifth" ] }, "ninety_sixth" => { name: "ninety_sixth", description: "returns the ninety sixth item.", examples: [ "(1..96).to_list.ninety_sixth", "(1..97).to_list.ninety_sixth", "[].ninety_sixth" ] }, "ninety_seventh" => { name: "ninety_seventh", description: "returns the ninety seventh item.", examples: [ "(1..97).to_list.ninety_seventh", "(1..98).to_list.ninety_seventh", "[].ninety_seventh" ] }, "ninety_eighth" => { name: "ninety_eighth", description: "returns the ninety eighth item.", examples: [ "(1..98).to_list.ninety_eighth", "(1..99).to_list.ninety_eighth", "[].ninety_eighth" ] }, "ninety_ninth" => { name: "ninety_ninth", description: "returns the ninety ninth item.", examples: [ "(1..99).to_list.ninety_ninth", "(1..100).to_list.ninety_ninth", "[].ninety_ninth" ] }, "one_hundredth" => { name: "one_hundredth", description: "returns the one hundredth item.", examples: [ "(1..100).to_list.one_hundredth", "(1..101).to_list.one_hundredth", "[].one_hundredth" ] }, "many?" => { name: "many?", description: "returns whether the list has more than one item.", examples: ["[1, 2].many?", "[1].many?", "[].many?"] }, "positive?" => { name: "positive?", description: "returns whether the list size is positive.", examples: ["[1].positive?", "[].positive?", "[1, 2].positive?"] }, "negative?" => { name: "negative?", description: "returns whether the list size is negative.", examples: ["[].negative?", "[1].negative?", "[1, 2].negative?"] }, "zero?" => { name: "zero?", description: "returns whether the list size is zero.", examples: ["(1..0).to_list.zero?", "(1..1).to_list.zero?", "[].zero?"] }, "one?" => { name: "one?", description: "returns whether the list size is one.", examples: ["(1..1).to_list.one?", "(1..2).to_list.one?", "[].one?"] }, "two?" => { name: "two?", description: "returns whether the list size is two.", examples: ["(1..2).to_list.two?", "(1..3).to_list.two?", "[].two?"] }, "three?" => { name: "three?", description: "returns whether the list size is three.", examples: [ "(1..3).to_list.three?", "(1..4).to_list.three?", "[].three?" ] }, "four?" => { name: "four?", description: "returns whether the list size is four.", examples: ["(1..4).to_list.four?", "(1..5).to_list.four?", "[].four?"] }, "five?" => { name: "five?", description: "returns whether the list size is five.", examples: ["(1..5).to_list.five?", "(1..6).to_list.five?", "[].five?"] }, "six?" => { name: "six?", description: "returns whether the list size is six.", examples: ["(1..6).to_list.six?", "(1..7).to_list.six?", "[].six?"] }, "seven?" => { name: "seven?", description: "returns whether the list size is seven.", examples: [ "(1..7).to_list.seven?", "(1..8).to_list.seven?", "[].seven?" ] }, "eight?" => { name: "eight?", description: "returns whether the list size is eight.", examples: [ "(1..8).to_list.eight?", "(1..9).to_list.eight?", "[].eight?" ] }, "nine?" => { name: "nine?", description: "returns whether the list size is nine.", examples: [ "(1..9).to_list.nine?", "(1..10).to_list.nine?", "[].nine?" ] }, "ten?" => { name: "ten?", description: "returns whether the list size is ten.", examples: ["(1..10).to_list.ten?", "(1..11).to_list.ten?", "[].ten?"] }, "eleven?" => { name: "eleven?", description: "returns whether the list size is eleven.", examples: [ "(1..11).to_list.eleven?", "(1..12).to_list.eleven?", "[].eleven?" ] }, "twelve?" => { name: "twelve?", description: "returns whether the list size is twelve.", examples: [ "(1..12).to_list.twelve?", "(1..13).to_list.twelve?", "[].twelve?" ] }, "thirteen?" => { name: "thirteen?", description: "returns whether the list size is thirteen.", examples: [ "(1..13).to_list.thirteen?", "(1..14).to_list.thirteen?", "[].thirteen?" ] }, "fourteen?" => { name: "fourteen?", description: "returns whether the list size is fourteen.", examples: [ "(1..14).to_list.fourteen?", "(1..15).to_list.fourteen?", "[].fourteen?" ] }, "fifteen?" => { name: "fifteen?", description: "returns whether the list size is fifteen.", examples: [ "(1..15).to_list.fifteen?", "(1..16).to_list.fifteen?", "[].fifteen?" ] }, "sixteen?" => { name: "sixteen?", description: "returns whether the list size is sixteen.", examples: [ "(1..16).to_list.sixteen?", "(1..17).to_list.sixteen?", "[].sixteen?" ] }, "seventeen?" => { name: "seventeen?", description: "returns whether the list size is seventeen.", examples: [ "(1..17).to_list.seventeen?", "(1..18).to_list.seventeen?", "[].seventeen?" ] }, "eighteen?" => { name: "eighteen?", description: "returns whether the list size is eighteen.", examples: [ "(1..18).to_list.eighteen?", "(1..19).to_list.eighteen?", "[].eighteen?" ] }, "nineteen?" => { name: "nineteen?", description: "returns whether the list size is nineteen.", examples: [ "(1..19).to_list.nineteen?", "(1..20).to_list.nineteen?", "[].nineteen?" ] }, "twenty?" => { name: "twenty?", description: "returns whether the list size is twenty.", examples: [ "(1..20).to_list.twenty?", "(1..21).to_list.twenty?", "[].twenty?" ] }, "twenty_one?" => { name: "twenty_one?", description: "returns whether the list size is twenty one.", examples: [ "(1..21).to_list.twenty_one?", "(1..22).to_list.twenty_one?", "[].twenty_one?" ] }, "twenty_two?" => { name: "twenty_two?", description: "returns whether the list size is twenty two.", examples: [ "(1..22).to_list.twenty_two?", "(1..23).to_list.twenty_two?", "[].twenty_two?" ] }, "twenty_three?" => { name: "twenty_three?", description: "returns whether the list size is twenty three.", examples: [ "(1..23).to_list.twenty_three?", "(1..24).to_list.twenty_three?", "[].twenty_three?" ] }, "twenty_four?" => { name: "twenty_four?", description: "returns whether the list size is twenty four.", examples: [ "(1..24).to_list.twenty_four?", "(1..25).to_list.twenty_four?", "[].twenty_four?" ] }, "twenty_five?" => { name: "twenty_five?", description: "returns whether the list size is twenty five.", examples: [ "(1..25).to_list.twenty_five?", "(1..26).to_list.twenty_five?", "[].twenty_five?" ] }, "twenty_six?" => { name: "twenty_six?", description: "returns whether the list size is twenty six.", examples: [ "(1..26).to_list.twenty_six?", "(1..27).to_list.twenty_six?", "[].twenty_six?" ] }, "twenty_seven?" => { name: "twenty_seven?", description: "returns whether the list size is twenty seven.", examples: [ "(1..27).to_list.twenty_seven?", "(1..28).to_list.twenty_seven?", "[].twenty_seven?" ] }, "twenty_eight?" => { name: "twenty_eight?", description: "returns whether the list size is twenty eight.", examples: [ "(1..28).to_list.twenty_eight?", "(1..29).to_list.twenty_eight?", "[].twenty_eight?" ] }, "twenty_nine?" => { name: "twenty_nine?", description: "returns whether the list size is twenty nine.", examples: [ "(1..29).to_list.twenty_nine?", "(1..30).to_list.twenty_nine?", "[].twenty_nine?" ] }, "thirty?" => { name: "thirty?", description: "returns whether the list size is thirty.", examples: [ "(1..30).to_list.thirty?", "(1..31).to_list.thirty?", "[].thirty?" ] }, "thirty_one?" => { name: "thirty_one?", description: "returns whether the list size is thirty one.", examples: [ "(1..31).to_list.thirty_one?", "(1..32).to_list.thirty_one?", "[].thirty_one?" ] }, "thirty_two?" => { name: "thirty_two?", description: "returns whether the list size is thirty two.", examples: [ "(1..32).to_list.thirty_two?", "(1..33).to_list.thirty_two?", "[].thirty_two?" ] }, "thirty_three?" => { name: "thirty_three?", description: "returns whether the list size is thirty three.", examples: [ "(1..33).to_list.thirty_three?", "(1..34).to_list.thirty_three?", "[].thirty_three?" ] }, "thirty_four?" => { name: "thirty_four?", description: "returns whether the list size is thirty four.", examples: [ "(1..34).to_list.thirty_four?", "(1..35).to_list.thirty_four?", "[].thirty_four?" ] }, "thirty_five?" => { name: "thirty_five?", description: "returns whether the list size is thirty five.", examples: [ "(1..35).to_list.thirty_five?", "(1..36).to_list.thirty_five?", "[].thirty_five?" ] }, "thirty_six?" => { name: "thirty_six?", description: "returns whether the list size is thirty six.", examples: [ "(1..36).to_list.thirty_six?", "(1..37).to_list.thirty_six?", "[].thirty_six?" ] }, "thirty_seven?" => { name: "thirty_seven?", description: "returns whether the list size is thirty seven.", examples: [ "(1..37).to_list.thirty_seven?", "(1..38).to_list.thirty_seven?", "[].thirty_seven?" ] }, "thirty_eight?" => { name: "thirty_eight?", description: "returns whether the list size is thirty eight.", examples: [ "(1..38).to_list.thirty_eight?", "(1..39).to_list.thirty_eight?", "[].thirty_eight?" ] }, "thirty_nine?" => { name: "thirty_nine?", description: "returns whether the list size is thirty nine.", examples: [ "(1..39).to_list.thirty_nine?", "(1..40).to_list.thirty_nine?", "[].thirty_nine?" ] }, "forty?" => { name: "forty?", description: "returns whether the list size is forty.", examples: [ "(1..40).to_list.forty?", "(1..41).to_list.forty?", "[].forty?" ] }, "forty_one?" => { name: "forty_one?", description: "returns whether the list size is forty one.", examples: [ "(1..41).to_list.forty_one?", "(1..42).to_list.forty_one?", "[].forty_one?" ] }, "forty_two?" => { name: "forty_two?", description: "returns whether the list size is forty two.", examples: [ "(1..42).to_list.forty_two?", "(1..43).to_list.forty_two?", "[].forty_two?" ] }, "forty_three?" => { name: "forty_three?", description: "returns whether the list size is forty three.", examples: [ "(1..43).to_list.forty_three?", "(1..44).to_list.forty_three?", "[].forty_three?" ] }, "forty_four?" => { name: "forty_four?", description: "returns whether the list size is forty four.", examples: [ "(1..44).to_list.forty_four?", "(1..45).to_list.forty_four?", "[].forty_four?" ] }, "forty_five?" => { name: "forty_five?", description: "returns whether the list size is forty five.", examples: [ "(1..45).to_list.forty_five?", "(1..46).to_list.forty_five?", "[].forty_five?" ] }, "forty_six?" => { name: "forty_six?", description: "returns whether the list size is forty six.", examples: [ "(1..46).to_list.forty_six?", "(1..47).to_list.forty_six?", "[].forty_six?" ] }, "forty_seven?" => { name: "forty_seven?", description: "returns whether the list size is forty seven.", examples: [ "(1..47).to_list.forty_seven?", "(1..48).to_list.forty_seven?", "[].forty_seven?" ] }, "forty_eight?" => { name: "forty_eight?", description: "returns whether the list size is forty eight.", examples: [ "(1..48).to_list.forty_eight?", "(1..49).to_list.forty_eight?", "[].forty_eight?" ] }, "forty_nine?" => { name: "forty_nine?", description: "returns whether the list size is forty nine.", examples: [ "(1..49).to_list.forty_nine?", "(1..50).to_list.forty_nine?", "[].forty_nine?" ] }, "fifty?" => { name: "fifty?", description: "returns whether the list size is fifty.", examples: [ "(1..50).to_list.fifty?", "(1..51).to_list.fifty?", "[].fifty?" ] }, "fifty_one?" => { name: "fifty_one?", description: "returns whether the list size is fifty one.", examples: [ "(1..51).to_list.fifty_one?", "(1..52).to_list.fifty_one?", "[].fifty_one?" ] }, "fifty_two?" => { name: "fifty_two?", description: "returns whether the list size is fifty two.", examples: [ "(1..52).to_list.fifty_two?", "(1..53).to_list.fifty_two?", "[].fifty_two?" ] }, "fifty_three?" => { name: "fifty_three?", description: "returns whether the list size is fifty three.", examples: [ "(1..53).to_list.fifty_three?", "(1..54).to_list.fifty_three?", "[].fifty_three?" ] }, "fifty_four?" => { name: "fifty_four?", description: "returns whether the list size is fifty four.", examples: [ "(1..54).to_list.fifty_four?", "(1..55).to_list.fifty_four?", "[].fifty_four?" ] }, "fifty_five?" => { name: "fifty_five?", description: "returns whether the list size is fifty five.", examples: [ "(1..55).to_list.fifty_five?", "(1..56).to_list.fifty_five?", "[].fifty_five?" ] }, "fifty_six?" => { name: "fifty_six?", description: "returns whether the list size is fifty six.", examples: [ "(1..56).to_list.fifty_six?", "(1..57).to_list.fifty_six?", "[].fifty_six?" ] }, "fifty_seven?" => { name: "fifty_seven?", description: "returns whether the list size is fifty seven.", examples: [ "(1..57).to_list.fifty_seven?", "(1..58).to_list.fifty_seven?", "[].fifty_seven?" ] }, "fifty_eight?" => { name: "fifty_eight?", description: "returns whether the list size is fifty eight.", examples: [ "(1..58).to_list.fifty_eight?", "(1..59).to_list.fifty_eight?", "[].fifty_eight?" ] }, "fifty_nine?" => { name: "fifty_nine?", description: "returns whether the list size is fifty nine.", examples: [ "(1..59).to_list.fifty_nine?", "(1..60).to_list.fifty_nine?", "[].fifty_nine?" ] }, "sixty?" => { name: "sixty?", description: "returns whether the list size is sixty.", examples: [ "(1..60).to_list.sixty?", "(1..61).to_list.sixty?", "[].sixty?" ] }, "sixty_one?" => { name: "sixty_one?", description: "returns whether the list size is sixty one.", examples: [ "(1..61).to_list.sixty_one?", "(1..62).to_list.sixty_one?", "[].sixty_one?" ] }, "sixty_two?" => { name: "sixty_two?", description: "returns whether the list size is sixty two.", examples: [ "(1..62).to_list.sixty_two?", "(1..63).to_list.sixty_two?", "[].sixty_two?" ] }, "sixty_three?" => { name: "sixty_three?", description: "returns whether the list size is sixty three.", examples: [ "(1..63).to_list.sixty_three?", "(1..64).to_list.sixty_three?", "[].sixty_three?" ] }, "sixty_four?" => { name: "sixty_four?", description: "returns whether the list size is sixty four.", examples: [ "(1..64).to_list.sixty_four?", "(1..65).to_list.sixty_four?", "[].sixty_four?" ] }, "sixty_five?" => { name: "sixty_five?", description: "returns whether the list size is sixty five.", examples: [ "(1..65).to_list.sixty_five?", "(1..66).to_list.sixty_five?", "[].sixty_five?" ] }, "sixty_six?" => { name: "sixty_six?", description: "returns whether the list size is sixty six.", examples: [ "(1..66).to_list.sixty_six?", "(1..67).to_list.sixty_six?", "[].sixty_six?" ] }, "sixty_seven?" => { name: "sixty_seven?", description: "returns whether the list size is sixty seven.", examples: [ "(1..67).to_list.sixty_seven?", "(1..68).to_list.sixty_seven?", "[].sixty_seven?" ] }, "sixty_eight?" => { name: "sixty_eight?", description: "returns whether the list size is sixty eight.", examples: [ "(1..68).to_list.sixty_eight?", "(1..69).to_list.sixty_eight?", "[].sixty_eight?" ] }, "sixty_nine?" => { name: "sixty_nine?", description: "returns whether the list size is sixty nine.", examples: [ "(1..69).to_list.sixty_nine?", "(1..70).to_list.sixty_nine?", "[].sixty_nine?" ] }, "seventy?" => { name: "seventy?", description: "returns whether the list size is seventy.", examples: [ "(1..70).to_list.seventy?", "(1..71).to_list.seventy?", "[].seventy?" ] }, "seventy_one?" => { name: "seventy_one?", description: "returns whether the list size is seventy one.", examples: [ "(1..71).to_list.seventy_one?", "(1..72).to_list.seventy_one?", "[].seventy_one?" ] }, "seventy_two?" => { name: "seventy_two?", description: "returns whether the list size is seventy two.", examples: [ "(1..72).to_list.seventy_two?", "(1..73).to_list.seventy_two?", "[].seventy_two?" ] }, "seventy_three?" => { name: "seventy_three?", description: "returns whether the list size is seventy three.", examples: [ "(1..73).to_list.seventy_three?", "(1..74).to_list.seventy_three?", "[].seventy_three?" ] }, "seventy_four?" => { name: "seventy_four?", description: "returns whether the list size is seventy four.", examples: [ "(1..74).to_list.seventy_four?", "(1..75).to_list.seventy_four?", "[].seventy_four?" ] }, "seventy_five?" => { name: "seventy_five?", description: "returns whether the list size is seventy five.", examples: [ "(1..75).to_list.seventy_five?", "(1..76).to_list.seventy_five?", "[].seventy_five?" ] }, "seventy_six?" => { name: "seventy_six?", description: "returns whether the list size is seventy six.", examples: [ "(1..76).to_list.seventy_six?", "(1..77).to_list.seventy_six?", "[].seventy_six?" ] }, "seventy_seven?" => { name: "seventy_seven?", description: "returns whether the list size is seventy seven.", examples: [ "(1..77).to_list.seventy_seven?", "(1..78).to_list.seventy_seven?", "[].seventy_seven?" ] }, "seventy_eight?" => { name: "seventy_eight?", description: "returns whether the list size is seventy eight.", examples: [ "(1..78).to_list.seventy_eight?", "(1..79).to_list.seventy_eight?", "[].seventy_eight?" ] }, "seventy_nine?" => { name: "seventy_nine?", description: "returns whether the list size is seventy nine.", examples: [ "(1..79).to_list.seventy_nine?", "(1..80).to_list.seventy_nine?", "[].seventy_nine?" ] }, "eighty?" => { name: "eighty?", description: "returns whether the list size is eighty.", examples: [ "(1..80).to_list.eighty?", "(1..81).to_list.eighty?", "[].eighty?" ] }, "eighty_one?" => { name: "eighty_one?", description: "returns whether the list size is eighty one.", examples: [ "(1..81).to_list.eighty_one?", "(1..82).to_list.eighty_one?", "[].eighty_one?" ] }, "eighty_two?" => { name: "eighty_two?", description: "returns whether the list size is eighty two.", examples: [ "(1..82).to_list.eighty_two?", "(1..83).to_list.eighty_two?", "[].eighty_two?" ] }, "eighty_three?" => { name: "eighty_three?", description: "returns whether the list size is eighty three.", examples: [ "(1..83).to_list.eighty_three?", "(1..84).to_list.eighty_three?", "[].eighty_three?" ] }, "eighty_four?" => { name: "eighty_four?", description: "returns whether the list size is eighty four.", examples: [ "(1..84).to_list.eighty_four?", "(1..85).to_list.eighty_four?", "[].eighty_four?" ] }, "eighty_five?" => { name: "eighty_five?", description: "returns whether the list size is eighty five.", examples: [ "(1..85).to_list.eighty_five?", "(1..86).to_list.eighty_five?", "[].eighty_five?" ] }, "eighty_six?" => { name: "eighty_six?", description: "returns whether the list size is eighty six.", examples: [ "(1..86).to_list.eighty_six?", "(1..87).to_list.eighty_six?", "[].eighty_six?" ] }, "eighty_seven?" => { name: "eighty_seven?", description: "returns whether the list size is eighty seven.", examples: [ "(1..87).to_list.eighty_seven?", "(1..88).to_list.eighty_seven?", "[].eighty_seven?" ] }, "eighty_eight?" => { name: "eighty_eight?", description: "returns whether the list size is eighty eight.", examples: [ "(1..88).to_list.eighty_eight?", "(1..89).to_list.eighty_eight?", "[].eighty_eight?" ] }, "eighty_nine?" => { name: "eighty_nine?", description: "returns whether the list size is eighty nine.", examples: [ "(1..89).to_list.eighty_nine?", "(1..90).to_list.eighty_nine?", "[].eighty_nine?" ] }, "ninety?" => { name: "ninety?", description: "returns whether the list size is ninety.", examples: [ "(1..90).to_list.ninety?", "(1..91).to_list.ninety?", "[].ninety?" ] }, "ninety_one?" => { name: "ninety_one?", description: "returns whether the list size is ninety one.", examples: [ "(1..91).to_list.ninety_one?", "(1..92).to_list.ninety_one?", "[].ninety_one?" ] }, "ninety_two?" => { name: "ninety_two?", description: "returns whether the list size is ninety two.", examples: [ "(1..92).to_list.ninety_two?", "(1..93).to_list.ninety_two?", "[].ninety_two?" ] }, "ninety_three?" => { name: "ninety_three?", description: "returns whether the list size is ninety three.", examples: [ "(1..93).to_list.ninety_three?", "(1..94).to_list.ninety_three?", "[].ninety_three?" ] }, "ninety_four?" => { name: "ninety_four?", description: "returns whether the list size is ninety four.", examples: [ "(1..94).to_list.ninety_four?", "(1..95).to_list.ninety_four?", "[].ninety_four?" ] }, "ninety_five?" => { name: "ninety_five?", description: "returns whether the list size is ninety five.", examples: [ "(1..95).to_list.ninety_five?", "(1..96).to_list.ninety_five?", "[].ninety_five?" ] }, "ninety_six?" => { name: "ninety_six?", description: "returns whether the list size is ninety six.", examples: [ "(1..96).to_list.ninety_six?", "(1..97).to_list.ninety_six?", "[].ninety_six?" ] }, "ninety_seven?" => { name: "ninety_seven?", description: "returns whether the list size is ninety seven.", examples: [ "(1..97).to_list.ninety_seven?", "(1..98).to_list.ninety_seven?", "[].ninety_seven?" ] }, "ninety_eight?" => { name: "ninety_eight?", description: "returns whether the list size is ninety eight.", examples: [ "(1..98).to_list.ninety_eight?", "(1..99).to_list.ninety_eight?", "[].ninety_eight?" ] }, "ninety_nine?" => { name: "ninety_nine?", description: "returns whether the list size is ninety nine.", examples: [ "(1..99).to_list.ninety_nine?", "(1..100).to_list.ninety_nine?", "[].ninety_nine?" ] }, "one_hundred?" => { name: "one_hundred?", description: "returns whether the list size is one hundred.", examples: [ "(1..100).to_list.one_hundred?", "(1..101).to_list.one_hundred?", "[].one_hundred?" ] } }.freeze
Constants inherited from Code::Object
CLASS_FUNCTIONS, NUMBER_CLASSES
Constants included from Concerns::Shared
Concerns::Shared::COMPOUND_ASSIGNMENT_OPERATORS, Concerns::Shared::OPERATOR_METHOD_ALIASES, Concerns::Shared::SHARED_OPERATORS
Instance Attribute Summary
Attributes included from Concerns::Shared
Class Method Summary collapse
Instance Method Summary collapse
- #any? ⇒ Boolean
- #call(**args) ⇒ Object
- #code_all?(argument = nil, **globals) ⇒ Boolean
- #code_any?(argument = nil, **globals) ⇒ Boolean
- #code_append(other) ⇒ Object
- #code_associate(value) ⇒ Object
- #code_clear ⇒ Object
- #code_combination(size) ⇒ Object
- #code_compact(argument = nil, **globals) ⇒ Object
- #code_compact!(argument = nil, **globals) ⇒ Object
- #code_concat(*lists) ⇒ Object
- #code_count(argument = nil, **globals) ⇒ Object
- #code_cycle(times = nil, function = nil, **globals) ⇒ Object
- #code_deep_duplicate(seen = {}) ⇒ Object
- #code_delete(value) ⇒ Object
- #code_delete_at(index) ⇒ Object
- #code_delete_if(argument, **globals) ⇒ Object
- #code_detect(argument = nil, **globals) ⇒ Object
- #code_difference(*lists) ⇒ Object
- #code_drop(n) ⇒ Object
- #code_drop_while(argument, **globals) ⇒ Object
- #code_each(argument = nil, **globals) ⇒ Object
- #code_each_index(argument, **globals) ⇒ Object
- #code_eighteenth ⇒ Object
- #code_eighth ⇒ Object
- #code_eightieth ⇒ Object
- #code_eighty_eighth ⇒ Object
- #code_eighty_fifth ⇒ Object
- #code_eighty_first ⇒ Object
- #code_eighty_fourth ⇒ Object
- #code_eighty_ninth ⇒ Object
- #code_eighty_second ⇒ Object
- #code_eighty_seventh ⇒ Object
- #code_eighty_sixth ⇒ Object
- #code_eighty_third ⇒ Object
- #code_eleventh ⇒ Object
- #code_empty? ⇒ Boolean
- #code_entries ⇒ Object
- #code_fetch(key) ⇒ Object
- #code_fifteenth ⇒ Object
- #code_fifth ⇒ Object
- #code_fiftieth ⇒ Object
- #code_fifty_eighth ⇒ Object
- #code_fifty_fifth ⇒ Object
- #code_fifty_first ⇒ Object
- #code_fifty_fourth ⇒ Object
- #code_fifty_ninth ⇒ Object
- #code_fifty_second ⇒ Object
- #code_fifty_seventh ⇒ Object
- #code_fifty_sixth ⇒ Object
- #code_fifty_third ⇒ Object
- #code_fill(value, start = nil, length = nil) ⇒ Object
- #code_first(value = nil) ⇒ Object
- #code_flat_map(argument = nil, **globals) ⇒ Object
- #code_flatten(level = nil) ⇒ Object
- #code_fortieth ⇒ Object
- #code_forty_eighth ⇒ Object
- #code_forty_fifth ⇒ Object
- #code_forty_first ⇒ Object
- #code_forty_fourth ⇒ Object
- #code_forty_ninth ⇒ Object
- #code_forty_second ⇒ Object
- #code_forty_seventh ⇒ Object
- #code_forty_sixth ⇒ Object
- #code_forty_third ⇒ Object
- #code_fourteenth ⇒ Object
- #code_fourth ⇒ Object
- #code_get(argument) ⇒ Object
- #code_group(argument = nil, **globals) ⇒ Object
- #code_include?(other) ⇒ Boolean
- #code_index(argument = nil, **globals) ⇒ Object
- #code_insert(index, value) ⇒ Object
- #code_intersect?(list) ⇒ Boolean
- #code_intersection(*lists) ⇒ Object
- #code_join(separator = nil) ⇒ Object
- #code_keep_if(argument, **globals) ⇒ Object
- #code_last ⇒ Object
- #code_map(argument = nil, **globals) ⇒ Object
- #code_map!(argument = nil, **globals) ⇒ Object
- #code_max(argument = nil, **globals) ⇒ Object
- #code_maximum(argument = nil, **globals) ⇒ Object
- #code_minimum(argument = nil, **globals) ⇒ Object
- #code_minimum_maximum(argument = nil, **globals) ⇒ Object
- #code_minus(other) ⇒ Object
- #code_nineteenth ⇒ Object
- #code_ninetieth ⇒ Object
- #code_ninety_eighth ⇒ Object
- #code_ninety_fifth ⇒ Object
- #code_ninety_first ⇒ Object
- #code_ninety_fourth ⇒ Object
- #code_ninety_ninth ⇒ Object
- #code_ninety_second ⇒ Object
- #code_ninety_seventh ⇒ Object
- #code_ninety_sixth ⇒ Object
- #code_ninety_third ⇒ Object
- #code_ninth ⇒ Object
- #code_none?(argument = nil, **globals) ⇒ Boolean
- #code_nth(index) ⇒ Object
- #code_one_hundredth ⇒ Object
- #code_partition(argument, **globals) ⇒ Object
- #code_permutation(size = nil) ⇒ Object
- #code_plus(other) ⇒ Object
- #code_pop(n = nil) ⇒ Object
- #code_pop!(n = nil) ⇒ Object
- #code_prepend(other) ⇒ Object
- #code_product(*lists) ⇒ Object
- #code_push(other) ⇒ Object
- #code_reduce(argument = nil, **globals) ⇒ Object
- #code_reject(argument = nil, **globals) ⇒ Object
- #code_reject!(argument = nil, **globals) ⇒ Object
- #code_repeated_combination(size) ⇒ Object
- #code_repeated_permutation(size) ⇒ Object
- #code_reverse ⇒ Object
- #code_reverse! ⇒ Object
- #code_reverse_each(argument, **globals) ⇒ Object
- #code_right_associate(value) ⇒ Object
- #code_right_index(argument = nil, **globals) ⇒ Object
- #code_rotate(count = nil) ⇒ Object
- #code_rotate!(count = nil) ⇒ Object
- #code_sample(value = nil) ⇒ Object
- #code_second ⇒ Object
- #code_select(argument = nil, **globals) ⇒ Object
- #code_select!(argument = nil, **globals) ⇒ Object
- #code_set(key, value) ⇒ Object
- #code_seventeenth ⇒ Object
- #code_seventh ⇒ Object
- #code_seventieth ⇒ Object
- #code_seventy_eighth ⇒ Object
- #code_seventy_fifth ⇒ Object
- #code_seventy_first ⇒ Object
- #code_seventy_fourth ⇒ Object
- #code_seventy_ninth ⇒ Object
- #code_seventy_second ⇒ Object
- #code_seventy_seventh ⇒ Object
- #code_seventy_sixth ⇒ Object
- #code_seventy_third ⇒ Object
- #code_shift(n = nil) ⇒ Object
- #code_shuffle ⇒ Object
- #code_shuffle! ⇒ Object
- #code_sixteenth ⇒ Object
- #code_sixth ⇒ Object
- #code_sixtieth ⇒ Object
- #code_sixty_eighth ⇒ Object
- #code_sixty_fifth ⇒ Object
- #code_sixty_first ⇒ Object
- #code_sixty_fourth ⇒ Object
- #code_sixty_ninth ⇒ Object
- #code_sixty_second ⇒ Object
- #code_sixty_seventh ⇒ Object
- #code_sixty_sixth ⇒ Object
- #code_sixty_third ⇒ Object
- #code_size ⇒ Object
- #code_slice(*arguments) ⇒ Object
- #code_slice!(*arguments) ⇒ Object
- #code_sort(argument = nil, **globals) ⇒ Object
- #code_sort!(argument = nil, **globals) ⇒ Object
- #code_sort_by!(argument = nil, **globals) ⇒ Object
- #code_sum ⇒ Object
- #code_take(n) ⇒ Object
- #code_take_while(argument, **globals) ⇒ Object
- #code_tally ⇒ Object
- #code_tenth ⇒ Object
- #code_third ⇒ Object
- #code_thirteenth ⇒ Object
- #code_thirtieth ⇒ Object
- #code_thirty_eighth ⇒ Object
- #code_thirty_fifth ⇒ Object
- #code_thirty_first ⇒ Object
- #code_thirty_fourth ⇒ Object
- #code_thirty_ninth ⇒ Object
- #code_thirty_second ⇒ Object
- #code_thirty_seventh ⇒ Object
- #code_thirty_sixth ⇒ Object
- #code_thirty_third ⇒ Object
- #code_to_dictionary ⇒ Object
- #code_transpose ⇒ Object
- #code_twelfth ⇒ Object
- #code_twentieth ⇒ Object
- #code_twenty_eighth ⇒ Object
- #code_twenty_fifth ⇒ Object
- #code_twenty_first ⇒ Object
- #code_twenty_fourth ⇒ Object
- #code_twenty_ninth ⇒ Object
- #code_twenty_second ⇒ Object
- #code_twenty_seventh ⇒ Object
- #code_twenty_sixth ⇒ Object
- #code_twenty_third ⇒ Object
- #code_union(*lists) ⇒ Object
- #code_uniq(argument = nil, **globals) ⇒ Object
- #code_uniq!(argument = nil, **globals) ⇒ Object
- #code_values_at(*indices) ⇒ Object
- #code_zip(*arguments) ⇒ Object
-
#initialize(*args, **_kargs, &_block) ⇒ List
constructor
A new instance of List.
- #present? ⇒ Boolean
Methods inherited from Code::Object
class_documentation, class_functions, code_new, #code_new, documentation, documentation_for, documented_functions_for, function_documentation_for, function_documentation_registry_for, functions, inherited_function_documentation_for, instance_functions, maybe, #name, repeat, sorted_dictionary, |
Methods included from Concerns::Shared
#<=>, #==, #as_json, #blank?, #code_and, #code_as_json, #code_blank?, #code_class_functions, #code_compare, #code_different, #code_documentable_functions, #code_documentation, #code_duplicate, #code_dynamic_call, #code_equal, #code_exclamation_mark, #code_exclusive_range, #code_false?, #code_falsy?, code_fetch, #code_functions, code_get, #code_greater, #code_greater_or_equal, #code_has_key?, #code_inclusive_range, #code_inspect, #code_instance_functions, #code_instance_of?, #code_is_a?, #code_itself, #code_less, #code_less_or_equal, #code_name, #code_nothing?, #code_or, #code_presence, #code_presence_in, #code_present?, #code_respond_to?, #code_same_object?, #code_self, #code_send, code_set, #code_something?, #code_strict_different, #code_strict_equal, #code_tap, #code_then, #code_to_boolean, #code_to_class, #code_to_date, #code_to_decimal, #code_to_duration, #code_to_integer, #code_to_json, #code_to_list, #code_to_nothing, #code_to_parameter, #code_to_range, #code_to_string, #code_to_time, #code_true?, #code_truthy?, #eql?, #falsy?, #hash, #inspect, #multi_fetch, #nothing?, #sig, #something?, #succ, #to_code, #to_i, #to_json, #to_s, #truthy?
Constructor Details
#initialize(*args, **_kargs, &_block) ⇒ List
Returns a new instance of List.
2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 |
# File 'lib/code/object/list.rb', line 2683 def initialize(*args, **_kargs, &_block) self.raw = if args.first.is_a?(List) args.first.raw.map(&:to_code) elsif args.first.is_a?(Dictionary) args.first.raw.to_a.map(&:to_code) elsif args.first.is_an?(::Array) args.first.map(&:to_code) elsif args.first.is_a?(::Hash) args.first.to_a.map(&:to_code) else [] end end |
Class Method Details
.function_documentation(scope) ⇒ Object
2569 2570 2571 2572 2573 |
# File 'lib/code/object/list.rb', line 2569 def self.function_documentation(scope) return INSTANCE_FUNCTIONS if scope == :instance {} end |
Instance Method Details
#any? ⇒ Boolean
5157 5158 5159 |
# File 'lib/code/object/list.rb', line 5157 def any? code_any?.truthy? end |
#call(**args) ⇒ Object
2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 |
# File 'lib/code/object/list.rb', line 2698 def call(**args) code_operator = args.fetch(:operator, nil).to_code code_arguments = args.fetch(:arguments, []).to_code globals = multi_fetch(args, *GLOBALS) code_value = code_arguments.code_first case code_operator.to_s when "[]", "at", "get" sig(args) { Integer } code_get(code_value) when "fetch" sig(args) { Integer } code_fetch(code_value) when "values_at" sig(args) { Integer.repeat(1) } code_values_at(*code_arguments.raw) when "slice" sig(args) { [Object, Integer.maybe] } code_slice(*code_arguments.raw) when "slice!" sig(args) { [Object, Integer.maybe] } code_slice!(*code_arguments.raw) when "clear" sig(args) code_clear when "join" sig(args) { String.maybe } code_join(code_value) when "sort" sig(args) { Function.maybe } code_sort(code_value, **globals) when "sort!" sig(args) { Function.maybe } code_sort!(code_value, **globals) when "<<", "append" sig(args) { Object } code_append(code_value) when "push" sig(args) { Object } code_push(code_value) when "prepend" sig(args) { Object } code_prepend(code_value) when "insert" sig(args) { [Integer, Object] } code_insert(*code_arguments.raw) when "concat" sig(args) { List.repeat(1) } code_concat(*code_arguments.raw) when "fill" sig(args) { [Object, Integer.maybe, Integer.maybe] } code_fill(*code_arguments.raw) when "+", "plus" sig(args) { List.maybe } code_arguments.any? ? code_plus(code_value) : code_self when "-", "minus" sig(args) { List } code_minus(code_value) when "any?" sig(args) { (Function | Class).maybe } code_any?(code_value, **globals) when "detect" sig(args) { (Function | Class).maybe } code_detect(code_value, **globals) when "index", "find_index" sig(args) { (Object | Function | Class).maybe } code_index(code_value, **globals) when "right_index" sig(args) { (Object | Function | Class).maybe } code_right_index(code_value, **globals) when "each" sig(args) { (Function | Class).maybe } code_each(code_value, **globals) when "each_index" sig(args) { Function } code_each_index(code_value, **globals) when "first" sig(args) { Integer.maybe } code_first(code_value) when "second" sig(args) code_second when "third" sig(args) code_third when "fourth" sig(args) code_fourth when "fifth" sig(args) code_fifth when "sixth" sig(args) code_sixth when "seventh" sig(args) code_seventh when "eighth" sig(args) code_eighth when "ninth" sig(args) code_ninth when "tenth" sig(args) code_tenth when "eleventh" sig(args) code_eleventh when "twelfth" sig(args) code_twelfth when "thirteenth" sig(args) code_thirteenth when "fourteenth" sig(args) code_fourteenth when "fifteenth" sig(args) code_fifteenth when "sixteenth" sig(args) code_sixteenth when "seventeenth" sig(args) code_seventeenth when "eighteenth" sig(args) code_eighteenth when "nineteenth" sig(args) code_nineteenth when "twentieth" sig(args) code_twentieth when "twenty_first" sig(args) code_twenty_first when "twenty_second" sig(args) code_twenty_second when "twenty_third" sig(args) code_twenty_third when "twenty_fourth" sig(args) code_twenty_fourth when "twenty_fifth" sig(args) code_twenty_fifth when "twenty_sixth" sig(args) code_twenty_sixth when "twenty_seventh" sig(args) code_twenty_seventh when "twenty_eighth" sig(args) code_twenty_eighth when "twenty_ninth" sig(args) code_twenty_ninth when "thirtieth" sig(args) code_thirtieth when "thirty_first" sig(args) code_thirty_first when "thirty_second" sig(args) code_thirty_second when "thirty_third" sig(args) code_thirty_third when "thirty_fourth" sig(args) code_thirty_fourth when "thirty_fifth" sig(args) code_thirty_fifth when "thirty_sixth" sig(args) code_thirty_sixth when "thirty_seventh" sig(args) code_thirty_seventh when "thirty_eighth" sig(args) code_thirty_eighth when "thirty_ninth" sig(args) code_thirty_ninth when "fortieth" sig(args) code_fortieth when "forty_first" sig(args) code_forty_first when "forty_second" sig(args) code_forty_second when "forty_third" sig(args) code_forty_third when "forty_fourth" sig(args) code_forty_fourth when "forty_fifth" sig(args) code_forty_fifth when "forty_sixth" sig(args) code_forty_sixth when "forty_seventh" sig(args) code_forty_seventh when "forty_eighth" sig(args) code_forty_eighth when "forty_ninth" sig(args) code_forty_ninth when "fiftieth" sig(args) code_fiftieth when "fifty_first" sig(args) code_fifty_first when "fifty_second" sig(args) code_fifty_second when "fifty_third" sig(args) code_fifty_third when "fifty_fourth" sig(args) code_fifty_fourth when "fifty_fifth" sig(args) code_fifty_fifth when "fifty_sixth" sig(args) code_fifty_sixth when "fifty_seventh" sig(args) code_fifty_seventh when "fifty_eighth" sig(args) code_fifty_eighth when "fifty_ninth" sig(args) code_fifty_ninth when "sixtieth" sig(args) code_sixtieth when "sixty_first" sig(args) code_sixty_first when "sixty_second" sig(args) code_sixty_second when "sixty_third" sig(args) code_sixty_third when "sixty_fourth" sig(args) code_sixty_fourth when "sixty_fifth" sig(args) code_sixty_fifth when "sixty_sixth" sig(args) code_sixty_sixth when "sixty_seventh" sig(args) code_sixty_seventh when "sixty_eighth" sig(args) code_sixty_eighth when "sixty_ninth" sig(args) code_sixty_ninth when "seventieth" sig(args) code_seventieth when "seventy_first" sig(args) code_seventy_first when "seventy_second" sig(args) code_seventy_second when "seventy_third" sig(args) code_seventy_third when "seventy_fourth" sig(args) code_seventy_fourth when "seventy_fifth" sig(args) code_seventy_fifth when "seventy_sixth" sig(args) code_seventy_sixth when "seventy_seventh" sig(args) code_seventy_seventh when "seventy_eighth" sig(args) code_seventy_eighth when "seventy_ninth" sig(args) code_seventy_ninth when "eightieth" sig(args) code_eightieth when "eighty_first" sig(args) code_eighty_first when "eighty_second" sig(args) code_eighty_second when "eighty_third" sig(args) code_eighty_third when "eighty_fourth" sig(args) code_eighty_fourth when "eighty_fifth" sig(args) code_eighty_fifth when "eighty_sixth" sig(args) code_eighty_sixth when "eighty_seventh" sig(args) code_eighty_seventh when "eighty_eighth" sig(args) code_eighty_eighth when "eighty_ninth" sig(args) code_eighty_ninth when "ninetieth" sig(args) code_ninetieth when "ninety_first" sig(args) code_ninety_first when "ninety_second" sig(args) code_ninety_second when "ninety_third" sig(args) code_ninety_third when "ninety_fourth" sig(args) code_ninety_fourth when "ninety_fifth" sig(args) code_ninety_fifth when "ninety_sixth" sig(args) code_ninety_sixth when "ninety_seventh" sig(args) code_ninety_seventh when "ninety_eighth" sig(args) code_ninety_eighth when "ninety_ninth" sig(args) code_ninety_ninth when "one_hundredth" sig(args) code_one_hundredth when "sample" sig(args) { Integer.maybe } code_sample(code_value) when "shuffle" sig(args) code_shuffle when "shuffle!" sig(args) code_shuffle! when "flatten" sig(args) { Integer.maybe } code_flatten(code_value) when "delete" sig(args) { Object } code_delete(code_value) when "delete_at" sig(args) { Integer } code_delete_at(code_value) when "delete_if" sig(args) { Function | Class } code_delete_if(code_value, **globals) when "keep_if" sig(args) { Function | Class } code_keep_if(code_value, **globals) when "pop" sig(args) { Integer.maybe } code_pop(code_value) when "pop!" sig(args) { Integer.maybe } code_pop!(code_value) when "shift" sig(args) { Integer.maybe } code_shift(code_value) when "include?", "member?" sig(args) { Object } code_include?(code_value) when "last" sig(args) code_last when "take" sig(args) { Integer } code_take(code_value) when "drop" sig(args) { Integer } code_drop(code_value) when "drop_while" sig(args) { Function | Class } code_drop_while(code_value, **globals) when "take_while" sig(args) { Function | Class } code_take_while(code_value, **globals) when "zip" sig(args) { List.repeat(1) } code_zip(*code_arguments.raw) when "map" sig(args) { (Function | Class).maybe } code_map(code_value, **globals) when "map!" sig(args) { (Function | Class).maybe } code_map!(code_value, **globals) when "flat_map" sig(args) { Function | Class } code_flat_map(code_value, **globals) when "max" sig(args) { (Function | Class).maybe } code_max(code_value, **globals) when "maximum" sig(args) { (Function | Class).maybe } code_maximum(code_value, **globals) when "minimum" sig(args) { (Function | Class).maybe } code_minimum(code_value, **globals) when "minimum_maximum" sig(args) { (Function | Class).maybe } code_minimum_maximum(code_value, **globals) when "none?" sig(args) { (Function | Class).maybe } code_none?(code_value, **globals) when "all?" sig(args) { (Function | Class).maybe } code_all?(code_value, **globals) when "reduce" sig(args) { (Function | Class).maybe } code_reduce(code_value, **globals) when "group" sig(args) { (Function | Class).maybe } code_group(code_value, **globals) when "partition" sig(args) { Function | Class } code_partition(code_value, **globals) when "cycle" sig(args) { [Integer.maybe, Function.maybe] } code_cycle(*code_arguments.raw, **globals) when "transpose" sig(args) code_transpose when "combination" sig(args) { Integer } code_combination(code_value) when "permutation" sig(args) { Integer.maybe } code_permutation(code_value) when "product" sig(args) { List.repeat(1) } code_product(*code_arguments.raw) when "repeated_combination" sig(args) { Integer } code_repeated_combination(code_value) when "repeated_permutation" sig(args) { Integer } code_repeated_permutation(code_value) when "reverse" sig(args) code_reverse when "reverse!" sig(args) code_reverse! when "reverse_each" sig(args) { Function } code_reverse_each(code_value, **globals) when "rotate" sig(args) { Integer.maybe } code_rotate(code_value) when "rotate!" sig(args) { Integer.maybe } code_rotate!(code_value) when "union" sig(args) { List.repeat(1) } code_union(*code_arguments.raw) when "intersection" sig(args) { List.repeat(1) } code_intersection(*code_arguments.raw) when "difference" sig(args) { List.repeat(1) } code_difference(*code_arguments.raw) when "intersect?" sig(args) { List } code_intersect?(code_value) when "associate" sig(args) { Object } code_associate(code_value) when "right_associate" sig(args) { Object } code_right_associate(code_value) when "select", "filter" sig(args) { (Function | Class).maybe } code_select(code_value, **globals) when "select!", "filter!" sig(args) { (Function | Class).maybe } code_select!(code_value, **globals) when "compact" sig(args) { (Function | Class).maybe } code_compact(code_value, **globals) when "compact!" sig(args) { (Function | Class).maybe } code_compact!(code_value, **globals) when "reject" sig(args) { (Function | Class).maybe } code_reject(code_value, **globals) when "reject!" sig(args) { (Function | Class).maybe } code_reject!(code_value, **globals) when "size", "length" sig(args) code_size when "empty?" sig(args) code_empty? when "count" sig(args) { (Function | Class).maybe } code_count(code_value, **globals) when "sum" sig(args) code_sum when "tally" sig(args) code_tally when "entries" sig(args) code_entries when "to_dictionary" sig(args) code_to_dictionary when "uniq" sig(args) { (Function | Class).maybe } code_uniq(code_value, **globals) when "sort_by!" sig(args) { (Function | Class).maybe } code_sort_by!(code_value, **globals) when "uniq!" sig(args) { (Function | Class).maybe } code_uniq!(code_value, **globals) when "many?" sig(args) code_many? when "positive?" sig(args) code_positive? when "negative?" sig(args) code_negative? when "zero?" sig(args) code_zero? when "one?" sig(args) code_one? when "two?" sig(args) code_two? when "three?" sig(args) code_three? when "four?" sig(args) code_four? when "five?" sig(args) code_five? when "six?" sig(args) code_six? when "seven?" sig(args) code_seven? when "eight?" sig(args) code_eight? when "nine?" sig(args) code_nine? when "ten?" sig(args) code_ten? when "eleven?" sig(args) code_eleven? when "twelve?" sig(args) code_twelve? when "thirteen?" sig(args) code_thirteen? when "fourteen?" sig(args) code_fourteen? when "fifteen?" sig(args) code_fifteen? when "sixteen?" sig(args) code_sixteen? when "seventeen?" sig(args) code_seventeen? when "eighteen?" sig(args) code_eighteen? when "nineteen?" sig(args) code_nineteen? when "twenty?" sig(args) code_twenty? when "twenty_one?" sig(args) code_twenty_one? when "twenty_two?" sig(args) code_twenty_two? when "twenty_three?" sig(args) code_twenty_three? when "twenty_four?" sig(args) code_twenty_four? when "twenty_five?" sig(args) code_twenty_five? when "twenty_six?" sig(args) code_twenty_six? when "twenty_seven?" sig(args) code_twenty_seven? when "twenty_eight?" sig(args) code_twenty_eight? when "twenty_nine?" sig(args) code_twenty_nine? when "thirty?" sig(args) code_thirty? when "thirty_one?" sig(args) code_thirty_one? when "thirty_two?" sig(args) code_thirty_two? when "thirty_three?" sig(args) code_thirty_three? when "thirty_four?" sig(args) code_thirty_four? when "thirty_five?" sig(args) code_thirty_five? when "thirty_six?" sig(args) code_thirty_six? when "thirty_seven?" sig(args) code_thirty_seven? when "thirty_eight?" sig(args) code_thirty_eight? when "thirty_nine?" sig(args) code_thirty_nine? when "forty?" sig(args) code_forty? when "forty_one?" sig(args) code_forty_one? when "forty_two?" sig(args) code_forty_two? when "forty_three?" sig(args) code_forty_three? when "forty_four?" sig(args) code_forty_four? when "forty_five?" sig(args) code_forty_five? when "forty_six?" sig(args) code_forty_six? when "forty_seven?" sig(args) code_forty_seven? when "forty_eight?" sig(args) code_forty_eight? when "forty_nine?" sig(args) code_forty_nine? when "fifty?" sig(args) code_fifty? when "fifty_one?" sig(args) code_fifty_one? when "fifty_two?" sig(args) code_fifty_two? when "fifty_three?" sig(args) code_fifty_three? when "fifty_four?" sig(args) code_fifty_four? when "fifty_five?" sig(args) code_fifty_five? when "fifty_six?" sig(args) code_fifty_six? when "fifty_seven?" sig(args) code_fifty_seven? when "fifty_eight?" sig(args) code_fifty_eight? when "fifty_nine?" sig(args) code_fifty_nine? when "sixty?" sig(args) code_sixty? when "sixty_one?" sig(args) code_sixty_one? when "sixty_two?" sig(args) code_sixty_two? when "sixty_three?" sig(args) code_sixty_three? when "sixty_four?" sig(args) code_sixty_four? when "sixty_five?" sig(args) code_sixty_five? when "sixty_six?" sig(args) code_sixty_six? when "sixty_seven?" sig(args) code_sixty_seven? when "sixty_eight?" sig(args) code_sixty_eight? when "sixty_nine?" sig(args) code_sixty_nine? when "seventy?" sig(args) code_seventy? when "seventy_one?" sig(args) code_seventy_one? when "seventy_two?" sig(args) code_seventy_two? when "seventy_three?" sig(args) code_seventy_three? when "seventy_four?" sig(args) code_seventy_four? when "seventy_five?" sig(args) code_seventy_five? when "seventy_six?" sig(args) code_seventy_six? when "seventy_seven?" sig(args) code_seventy_seven? when "seventy_eight?" sig(args) code_seventy_eight? when "seventy_nine?" sig(args) code_seventy_nine? when "eighty?" sig(args) code_eighty? when "eighty_one?" sig(args) code_eighty_one? when "eighty_two?" sig(args) code_eighty_two? when "eighty_three?" sig(args) code_eighty_three? when "eighty_four?" sig(args) code_eighty_four? when "eighty_five?" sig(args) code_eighty_five? when "eighty_six?" sig(args) code_eighty_six? when "eighty_seven?" sig(args) code_eighty_seven? when "eighty_eight?" sig(args) code_eighty_eight? when "eighty_nine?" sig(args) code_eighty_nine? when "ninety?" sig(args) code_ninety? when "ninety_one?" sig(args) code_ninety_one? when "ninety_two?" sig(args) code_ninety_two? when "ninety_three?" sig(args) code_ninety_three? when "ninety_four?" sig(args) code_ninety_four? when "ninety_five?" sig(args) code_ninety_five? when "ninety_six?" sig(args) code_ninety_six? when "ninety_seven?" sig(args) code_ninety_seven? when "ninety_eight?" sig(args) code_ninety_eight? when "ninety_nine?" sig(args) code_ninety_nine? when "one_hundred?" sig(args) code_one_hundred? else super end end |
#code_all?(argument = nil, **globals) ⇒ Boolean
4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 |
# File 'lib/code/object/list.rb', line 4541 def code_all?(argument = nil, **globals) code_argument = argument.to_code index = 0 Boolean.new( raw.all? do |code_element| if code_argument.is_a?(Function) code_argument .call( arguments: List.new([code_element, Integer.new(index), self]), **globals ) .truthy? .tap { index += 1 } elsif code_argument.is_a?(Class) code_element.is_a?(code_argument.raw).tap { index += 1 } else true.tap { index += 1 } end rescue Error::Next => e e.code_value.truthy?.tap { index += 1 } end ) rescue Error::Break => e e.code_value end |
#code_any?(argument = nil, **globals) ⇒ Boolean
3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 |
# File 'lib/code/object/list.rb', line 3583 def code_any?(argument = nil, **globals) code_argument = argument.to_code index = 0 Boolean.new( raw.any? do |code_element| if code_argument.is_a?(Function) code_argument .call( arguments: List.new([code_element, Integer.new(index), self]), **globals ) .truthy? .tap { index += 1 } elsif code_argument.is_a?(Class) code_element.is_a?(code_argument.raw).tap { index += 1 } else true.tap { index += 1 } end rescue Error::Next => e e.code_value.tap { index += 1 } end ) rescue Error::Break => e e.code_value end |
#code_append(other) ⇒ Object
3611 3612 3613 3614 3615 3616 3617 |
# File 'lib/code/object/list.rb', line 3611 def code_append(other) code_other = other.to_code raw << code_other self end |
#code_associate(value) ⇒ Object
4776 4777 4778 4779 4780 4781 4782 4783 4784 |
# File 'lib/code/object/list.rb', line 4776 def code_associate(value) code_value = value.to_code pair = raw.detect do |element| element.is_a?(List) && element.raw.first == code_value end pair || Nothing.new end |
#code_clear ⇒ Object
3619 3620 3621 3622 |
# File 'lib/code/object/list.rb', line 3619 def code_clear raw.clear self end |
#code_combination(size) ⇒ Object
4676 4677 4678 4679 4680 4681 |
# File 'lib/code/object/list.rb', line 4676 def code_combination(size) code_size = size.to_code List.new( raw.combination(code_size.raw).map { |values| List.new(values) } ) end |
#code_compact(argument = nil, **globals) ⇒ Object
4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 |
# File 'lib/code/object/list.rb', line 4796 def code_compact(argument = nil, **globals) code_argument = argument.to_code List.new( raw.reject.with_index do |code_element, index| if code_argument.nothing? code_element.nothing? elsif code_argument.is_a?(Function) code_argument.call( arguments: List.new([code_element, Integer.new(index), self]), **globals ).truthy? elsif code_argument.is_a?(Class) code_element.is_a?(code_argument.raw) else false end rescue Error::Next => e e.code_value.truthy? end ) rescue Error::Break => e e.code_value end |
#code_compact!(argument = nil, **globals) ⇒ Object
4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 |
# File 'lib/code/object/list.rb', line 4821 def code_compact!(argument = nil, **globals) code_argument = argument.to_code raw.reject!.with_index do |code_element, index| if code_argument.nothing? code_element.nothing? elsif code_argument.is_a?(Function) code_argument.call( arguments: List.new([code_element, Integer.new(index), self]), **globals ).truthy? elsif code_argument.is_a?(Class) code_element.is_a?(code_argument.raw) else false end rescue Error::Next => e e.code_value.truthy? end self rescue Error::Break => e e.code_value end |
#code_concat(*lists) ⇒ Object
3641 3642 3643 3644 |
# File 'lib/code/object/list.rb', line 3641 def code_concat(*lists) lists.to_code.raw.each { |list| raw.concat(list.raw) } self end |
#code_count(argument = nil, **globals) ⇒ Object
4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 |
# File 'lib/code/object/list.rb', line 4982 def code_count(argument = nil, **globals) code_argument = argument.to_code if code_argument.nothing? return Integer.new(raw.count) elsif code_argument.is_a?(Class) return( Integer.new( raw.count { |element| element.is_a?(code_argument.raw) } ) ) end index = 0 Integer.new( raw.count do |code_element| code_argument .call( arguments: List.new([code_element, Integer.new(index), self]), **globals ) .truthy? .tap { index += 1 } rescue Error::Next => e e.code_value.truthy?.tap { index += 1 } end ) rescue Error::Break => e e.code_value end |
#code_cycle(times = nil, function = nil, **globals) ⇒ Object
4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 |
# File 'lib/code/object/list.rb', line 4641 def code_cycle(times = nil, function = nil, **globals) code_times = times.to_code code_function = function.to_code if code_times.is_a?(Function) code_function = code_times code_times = Integer.new(1) elsif code_times.nothing? code_times = Integer.new(1) end cycled = raw.cycle(code_times.raw) if code_function.is_a?(Function) cycled.each.with_index do |code_element, index| code_function.call( arguments: List.new([code_element, Integer.new(index), self]), **globals ) rescue Error::Next => e e.code_value end self else List.new(cycled.to_a) end rescue Error::Break => e e.code_value end |
#code_deep_duplicate(seen = {}) ⇒ Object
5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 |
# File 'lib/code/object/list.rb', line 5063 def code_deep_duplicate(seen = {}) seen.compare_by_identity unless seen.compare_by_identity? return seen[self] if seen.key?(self) duplicate = List.new seen[self] = duplicate duplicate.raw.concat( raw.map { |value| value.code_deep_duplicate(seen) } ) duplicate end |
#code_delete(value) ⇒ Object
4237 4238 4239 4240 |
# File 'lib/code/object/list.rb', line 4237 def code_delete(value) code_value = value.to_code raw.delete(code_value) || Nothing.new end |
#code_delete_at(index) ⇒ Object
4242 4243 4244 4245 |
# File 'lib/code/object/list.rb', line 4242 def code_delete_at(index) code_index = index.to_code raw.delete_at(code_index.raw) || Nothing.new end |
#code_delete_if(argument, **globals) ⇒ Object
4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 |
# File 'lib/code/object/list.rb', line 4247 def code_delete_if(argument, **globals) code_argument = argument.to_code raw.delete_if.with_index do |code_element, index| if code_argument.is_a?(Class) code_element.is_a?(code_argument.raw) else code_argument.call( arguments: List.new([code_element, Integer.new(index), self]), **globals ).truthy? end rescue Error::Next => e e.code_value.truthy? end self rescue Error::Break => e e.code_value end |
#code_detect(argument = nil, **globals) ⇒ Object
3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 |
# File 'lib/code/object/list.rb', line 3674 def code_detect(argument = nil, **globals) code_argument = argument.to_code raw.detect.with_index do |code_element, index| if code_argument.is_a?(Function) code_argument.call( arguments: List.new([code_element, Integer.new(index), self]), **globals ).truthy? elsif code_argument.is_a?(Class) code_element.is_a?(code_argument.raw) else false end rescue Error::Next => e e.code_value end || Nothing.new rescue Error::Break => e e.code_value end |
#code_difference(*lists) ⇒ Object
4766 4767 4768 |
# File 'lib/code/object/list.rb', line 4766 def code_difference(*lists) List.new(raw.difference(*lists.to_code.raw.map(&:raw))) end |
#code_drop(n) ⇒ Object
4325 4326 4327 4328 |
# File 'lib/code/object/list.rb', line 4325 def code_drop(n) code_n = n.to_code List.new(raw.drop(code_n.raw)) end |
#code_drop_while(argument, **globals) ⇒ Object
4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 |
# File 'lib/code/object/list.rb', line 4330 def code_drop_while(argument, **globals) code_argument = argument.to_code List.new( raw.drop_while.with_index do |code_element, index| if code_argument.is_a?(Class) code_element.is_a?(code_argument.raw) else code_argument.call( arguments: List.new([code_element, Integer.new(index), self]), **globals ).truthy? end rescue Error::Next => e e.code_value.truthy? end ) rescue Error::Break => e e.code_value end |
#code_each(argument = nil, **globals) ⇒ Object
3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 |
# File 'lib/code/object/list.rb', line 3749 def code_each(argument = nil, **globals) code_argument = argument.to_code raw.each.with_index do |code_element, index| if code_argument.is_a?(Function) code_argument.call( arguments: List.new([code_element, Integer.new(index), self]), **globals ) elsif code_argument.is_a?(Class) code_argument.raw.new(code_element) end rescue Error::Next => e e.code_value end self rescue Error::Break => e e.code_value end |
#code_each_index(argument, **globals) ⇒ Object
3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 |
# File 'lib/code/object/list.rb', line 3770 def code_each_index(argument, **globals) code_argument = argument.to_code raw.each_index do |index| code_index = Integer.new(index) code_argument.call( arguments: List.new([code_index, code_index, self]), **globals ) rescue Error::Next => e e.code_value end self rescue Error::Break => e e.code_value end |
#code_eighteenth ⇒ Object
3866 3867 3868 |
# File 'lib/code/object/list.rb', line 3866 def code_eighteenth code_nth(17) end |
#code_eighth ⇒ Object
3826 3827 3828 |
# File 'lib/code/object/list.rb', line 3826 def code_eighth code_nth(7) end |
#code_eightieth ⇒ Object
4114 4115 4116 |
# File 'lib/code/object/list.rb', line 4114 def code_eightieth code_nth(79) end |
#code_eighty_eighth ⇒ Object
4146 4147 4148 |
# File 'lib/code/object/list.rb', line 4146 def code_eighty_eighth code_nth(87) end |
#code_eighty_fifth ⇒ Object
4134 4135 4136 |
# File 'lib/code/object/list.rb', line 4134 def code_eighty_fifth code_nth(84) end |
#code_eighty_first ⇒ Object
4118 4119 4120 |
# File 'lib/code/object/list.rb', line 4118 def code_eighty_first code_nth(80) end |
#code_eighty_fourth ⇒ Object
4130 4131 4132 |
# File 'lib/code/object/list.rb', line 4130 def code_eighty_fourth code_nth(83) end |
#code_eighty_ninth ⇒ Object
4150 4151 4152 |
# File 'lib/code/object/list.rb', line 4150 def code_eighty_ninth code_nth(88) end |
#code_eighty_second ⇒ Object
4122 4123 4124 |
# File 'lib/code/object/list.rb', line 4122 def code_eighty_second code_nth(81) end |
#code_eighty_seventh ⇒ Object
4142 4143 4144 |
# File 'lib/code/object/list.rb', line 4142 def code_eighty_seventh code_nth(86) end |
#code_eighty_sixth ⇒ Object
4138 4139 4140 |
# File 'lib/code/object/list.rb', line 4138 def code_eighty_sixth code_nth(85) end |
#code_eighty_third ⇒ Object
4126 4127 4128 |
# File 'lib/code/object/list.rb', line 4126 def code_eighty_third code_nth(82) end |
#code_eleventh ⇒ Object
3838 3839 3840 |
# File 'lib/code/object/list.rb', line 3838 def code_eleventh code_nth(10) end |
#code_empty? ⇒ Boolean
4978 4979 4980 |
# File 'lib/code/object/list.rb', line 4978 def code_empty? Boolean.new(raw.empty?) end |
#code_entries ⇒ Object
5017 5018 5019 |
# File 'lib/code/object/list.rb', line 5017 def code_entries List.new(raw) end |
#code_fetch(key) ⇒ Object
5138 5139 5140 5141 5142 5143 |
# File 'lib/code/object/list.rb', line 5138 def code_fetch(key) code_key = key.to_code return super unless code_key.is_a?(Integer) raw.fetch(code_key.code_to_integer.raw, Nothing.new) end |
#code_fifteenth ⇒ Object
3854 3855 3856 |
# File 'lib/code/object/list.rb', line 3854 def code_fifteenth code_nth(14) end |
#code_fifth ⇒ Object
3814 3815 3816 |
# File 'lib/code/object/list.rb', line 3814 def code_fifth code_nth(4) end |
#code_fiftieth ⇒ Object
3994 3995 3996 |
# File 'lib/code/object/list.rb', line 3994 def code_fiftieth code_nth(49) end |
#code_fifty_eighth ⇒ Object
4026 4027 4028 |
# File 'lib/code/object/list.rb', line 4026 def code_fifty_eighth code_nth(57) end |
#code_fifty_fifth ⇒ Object
4014 4015 4016 |
# File 'lib/code/object/list.rb', line 4014 def code_fifty_fifth code_nth(54) end |
#code_fifty_first ⇒ Object
3998 3999 4000 |
# File 'lib/code/object/list.rb', line 3998 def code_fifty_first code_nth(50) end |
#code_fifty_fourth ⇒ Object
4010 4011 4012 |
# File 'lib/code/object/list.rb', line 4010 def code_fifty_fourth code_nth(53) end |
#code_fifty_ninth ⇒ Object
4030 4031 4032 |
# File 'lib/code/object/list.rb', line 4030 def code_fifty_ninth code_nth(58) end |
#code_fifty_second ⇒ Object
4002 4003 4004 |
# File 'lib/code/object/list.rb', line 4002 def code_fifty_second code_nth(51) end |
#code_fifty_seventh ⇒ Object
4022 4023 4024 |
# File 'lib/code/object/list.rb', line 4022 def code_fifty_seventh code_nth(56) end |
#code_fifty_sixth ⇒ Object
4018 4019 4020 |
# File 'lib/code/object/list.rb', line 4018 def code_fifty_sixth code_nth(55) end |
#code_fifty_third ⇒ Object
4006 4007 4008 |
# File 'lib/code/object/list.rb', line 4006 def code_fifty_third code_nth(52) end |
#code_fill(value, start = nil, length = nil) ⇒ Object
3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 |
# File 'lib/code/object/list.rb', line 3646 def code_fill(value, start = nil, length = nil) code_value = value.to_code code_start = start.to_code code_length = length.to_code if code_start.nothing? raw.fill(code_value) elsif code_length.nothing? raw.fill(code_value, code_start.raw) else raw.fill(code_value, code_start.raw, code_length.raw) end self end |
#code_first(value = nil) ⇒ Object
3788 3789 3790 3791 3792 3793 3794 3795 3796 |
# File 'lib/code/object/list.rb', line 3788 def code_first(value = nil) code_value = value.to_code if code_value.nothing? raw.first || Nothing.new else List.new(raw.first(code_value.raw)) end end |
#code_flat_map(argument = nil, **globals) ⇒ Object
4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 |
# File 'lib/code/object/list.rb', line 4423 def code_flat_map(argument = nil, **globals) code_argument = argument.to_code List.new( raw.flat_map.with_index do |code_element, index| result = if code_argument.is_a?(Function) code_argument.call( arguments: List.new([code_element, Integer.new(index), self]), **globals ) elsif code_argument.is_a?(Class) code_argument.raw.new(code_element) else Nothing.new end result.is_a?(List) ? result.raw : result rescue Error::Next => e e.code_value.is_a?(List) ? e.code_value.raw : e.code_value end ) rescue Error::Break => e e.code_value end |
#code_flatten(level = nil) ⇒ Object
4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 |
# File 'lib/code/object/list.rb', line 4217 def code_flatten(level = nil) code_level = level.to_code code_level = Integer.new(-1) if code_level.nothing? level = code_level.raw List.new( raw.reduce([]) do |acc, code_element| if code_element.is_a?(List) && level != 0 if level.positive? acc + code_element.code_flatten(level - 1).raw else acc + code_element.code_flatten(level).raw end else acc + [code_element] end end ) end |
#code_fortieth ⇒ Object
3954 3955 3956 |
# File 'lib/code/object/list.rb', line 3954 def code_fortieth code_nth(39) end |
#code_forty_eighth ⇒ Object
3986 3987 3988 |
# File 'lib/code/object/list.rb', line 3986 def code_forty_eighth code_nth(47) end |
#code_forty_fifth ⇒ Object
3974 3975 3976 |
# File 'lib/code/object/list.rb', line 3974 def code_forty_fifth code_nth(44) end |
#code_forty_first ⇒ Object
3958 3959 3960 |
# File 'lib/code/object/list.rb', line 3958 def code_forty_first code_nth(40) end |
#code_forty_fourth ⇒ Object
3970 3971 3972 |
# File 'lib/code/object/list.rb', line 3970 def code_forty_fourth code_nth(43) end |
#code_forty_ninth ⇒ Object
3990 3991 3992 |
# File 'lib/code/object/list.rb', line 3990 def code_forty_ninth code_nth(48) end |
#code_forty_second ⇒ Object
3962 3963 3964 |
# File 'lib/code/object/list.rb', line 3962 def code_forty_second code_nth(41) end |
#code_forty_seventh ⇒ Object
3982 3983 3984 |
# File 'lib/code/object/list.rb', line 3982 def code_forty_seventh code_nth(46) end |
#code_forty_sixth ⇒ Object
3978 3979 3980 |
# File 'lib/code/object/list.rb', line 3978 def code_forty_sixth code_nth(45) end |
#code_forty_third ⇒ Object
3966 3967 3968 |
# File 'lib/code/object/list.rb', line 3966 def code_forty_third code_nth(42) end |
#code_fourteenth ⇒ Object
3850 3851 3852 |
# File 'lib/code/object/list.rb', line 3850 def code_fourteenth code_nth(13) end |
#code_fourth ⇒ Object
3810 3811 3812 |
# File 'lib/code/object/list.rb', line 3810 def code_fourth code_nth(3) end |
#code_get(argument) ⇒ Object
5075 5076 5077 5078 5079 |
# File 'lib/code/object/list.rb', line 5075 def code_get(argument) code_argument = argument.to_code raw[code_argument.raw] || Nothing.new end |
#code_group(argument = nil, **globals) ⇒ Object
4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 |
# File 'lib/code/object/list.rb', line 4593 def code_group(argument = nil, **globals) code_argument = argument.to_code grouped = raw.group_by.with_index do |code_element, index| if code_argument.is_a?(Function) code_argument.call( arguments: List.new([code_element, Integer.new(index), self]), **globals ) elsif code_argument.is_a?(Class) Boolean.new(code_element.is_a?(code_argument.raw)) else code_element end rescue Error::Next => e e.code_value end Dictionary.new(grouped.transform_values { |values| List.new(values) }) rescue Error::Break => e e.code_value end |
#code_include?(other) ⇒ Boolean
4310 4311 4312 4313 4314 |
# File 'lib/code/object/list.rb', line 4310 def code_include?(other) code_other = other.to_code Boolean.new(raw.include?(code_other)) end |
#code_index(argument = nil, **globals) ⇒ Object
3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 |
# File 'lib/code/object/list.rb', line 3695 def code_index(argument = nil, **globals) code_argument = argument.to_code if code_argument.nothing? return Nothing.new elsif code_argument.is_a?(Function) index = raw.index.with_index do |code_element, index| code_argument.call( arguments: List.new([code_element, Integer.new(index), self]), **globals ).truthy? rescue Error::Next => e e.code_value.truthy? end elsif code_argument.is_a?(Class) index = raw.index { |code_element| code_element.is_a?(code_argument.raw) } else index = raw.index(code_argument) end index.nil? ? Nothing.new : Integer.new(index) rescue Error::Break => e e.code_value end |
#code_insert(index, value) ⇒ Object
3634 3635 3636 3637 3638 3639 |
# File 'lib/code/object/list.rb', line 3634 def code_insert(index, value) code_index = index.to_code code_value = value.to_code raw.insert(code_index.raw, code_value) self end |
#code_intersect?(list) ⇒ Boolean
4770 4771 4772 4773 4774 |
# File 'lib/code/object/list.rb', line 4770 def code_intersect?(list) code_list = list.to_code Boolean.new(raw.intersect?(code_list.raw)) end |
#code_intersection(*lists) ⇒ Object
4762 4763 4764 |
# File 'lib/code/object/list.rb', line 4762 def code_intersection(*lists) List.new(raw.intersection(*lists.to_code.raw.map(&:raw))) end |
#code_join(separator = nil) ⇒ Object
4938 4939 4940 4941 4942 |
# File 'lib/code/object/list.rb', line 4938 def code_join(separator = nil) code_separator = separator.to_s.to_code String.new(raw.join(code_separator.raw)) end |
#code_keep_if(argument, **globals) ⇒ Object
4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 |
# File 'lib/code/object/list.rb', line 4268 def code_keep_if(argument, **globals) code_argument = argument.to_code raw.keep_if.with_index do |code_element, index| if code_argument.is_a?(Class) code_element.is_a?(code_argument.raw) else code_argument.call( arguments: List.new([code_element, Integer.new(index), self]), **globals ).truthy? end rescue Error::Next => e e.code_value.truthy? end self rescue Error::Break => e e.code_value end |
#code_last ⇒ Object
4316 4317 4318 |
# File 'lib/code/object/list.rb', line 4316 def code_last raw.last || Nothing.new end |
#code_map(argument = nil, **globals) ⇒ Object
4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 |
# File 'lib/code/object/list.rb', line 4377 def code_map(argument = nil, **globals) code_argument = argument.to_code List.new( raw.map.with_index do |code_element, index| if code_argument.is_a?(Function) code_argument.call( arguments: List.new([code_element, Integer.new(index), self]), **globals ) elsif code_argument.is_a?(Class) code_argument.raw.new(code_element) else Nothing.new end rescue Error::Next => e e.code_value end ) rescue Error::Break => e e.code_value end |
#code_map!(argument = nil, **globals) ⇒ Object
4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 |
# File 'lib/code/object/list.rb', line 4400 def code_map!(argument = nil, **globals) code_argument = argument.to_code raw.map!.with_index do |code_element, index| if code_argument.is_a?(Function) code_argument.call( arguments: List.new([code_element, Integer.new(index), self]), **globals ) elsif code_argument.is_a?(Class) code_argument.raw.new(code_element) else Nothing.new end rescue Error::Next => e e.code_value end self rescue Error::Break => e e.code_value end |
#code_max(argument = nil, **globals) ⇒ Object
4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 |
# File 'lib/code/object/list.rb', line 4449 def code_max(argument = nil, **globals) code_argument = argument.to_code raw.max_by.with_index do |code_element, index| if code_argument.is_a?(Function) code_argument.call( arguments: List.new([code_element, Integer.new(index), self]), **globals ).truthy? else code_element end rescue Error::Next => e e.code_value end || Nothing.new rescue Error::Break => e e.code_value end |
#code_maximum(argument = nil, **globals) ⇒ Object
4468 4469 4470 |
# File 'lib/code/object/list.rb', line 4468 def code_maximum(argument = nil, **globals) code_max(argument, **globals) end |
#code_minimum(argument = nil, **globals) ⇒ Object
4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 |
# File 'lib/code/object/list.rb', line 4472 def code_minimum(argument = nil, **globals) code_argument = argument.to_code raw.min_by.with_index do |code_element, index| if code_argument.is_a?(Function) code_argument.call( arguments: List.new([code_element, Integer.new(index), self]), **globals ) else code_element end rescue Error::Next => e e.code_value end || Nothing.new rescue Error::Break => e e.code_value end |
#code_minimum_maximum(argument = nil, **globals) ⇒ Object
4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 |
# File 'lib/code/object/list.rb', line 4491 def code_minimum_maximum(argument = nil, **globals) code_argument = argument.to_code values = raw.minmax_by.with_index do |code_element, index| if code_argument.is_a?(Function) code_argument.call( arguments: List.new([code_element, Integer.new(index), self]), **globals ) else code_element end rescue Error::Next => e e.code_value end List.new(values) rescue Error::Break => e e.code_value end |
#code_minus(other) ⇒ Object
3668 3669 3670 3671 3672 |
# File 'lib/code/object/list.rb', line 3668 def code_minus(other) code_other = other.to_code List.new(raw - code_other.raw) end |
#code_nineteenth ⇒ Object
3870 3871 3872 |
# File 'lib/code/object/list.rb', line 3870 def code_nineteenth code_nth(18) end |
#code_ninetieth ⇒ Object
4154 4155 4156 |
# File 'lib/code/object/list.rb', line 4154 def code_ninetieth code_nth(89) end |
#code_ninety_eighth ⇒ Object
4186 4187 4188 |
# File 'lib/code/object/list.rb', line 4186 def code_ninety_eighth code_nth(97) end |
#code_ninety_fifth ⇒ Object
4174 4175 4176 |
# File 'lib/code/object/list.rb', line 4174 def code_ninety_fifth code_nth(94) end |
#code_ninety_first ⇒ Object
4158 4159 4160 |
# File 'lib/code/object/list.rb', line 4158 def code_ninety_first code_nth(90) end |
#code_ninety_fourth ⇒ Object
4170 4171 4172 |
# File 'lib/code/object/list.rb', line 4170 def code_ninety_fourth code_nth(93) end |
#code_ninety_ninth ⇒ Object
4190 4191 4192 |
# File 'lib/code/object/list.rb', line 4190 def code_ninety_ninth code_nth(98) end |
#code_ninety_second ⇒ Object
4162 4163 4164 |
# File 'lib/code/object/list.rb', line 4162 def code_ninety_second code_nth(91) end |
#code_ninety_seventh ⇒ Object
4182 4183 4184 |
# File 'lib/code/object/list.rb', line 4182 def code_ninety_seventh code_nth(96) end |
#code_ninety_sixth ⇒ Object
4178 4179 4180 |
# File 'lib/code/object/list.rb', line 4178 def code_ninety_sixth code_nth(95) end |
#code_ninety_third ⇒ Object
4166 4167 4168 |
# File 'lib/code/object/list.rb', line 4166 def code_ninety_third code_nth(92) end |
#code_ninth ⇒ Object
3830 3831 3832 |
# File 'lib/code/object/list.rb', line 3830 def code_ninth code_nth(8) end |
#code_none?(argument = nil, **globals) ⇒ Boolean
4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 |
# File 'lib/code/object/list.rb', line 4513 def code_none?(argument = nil, **globals) code_argument = argument.to_code index = 0 Boolean.new( raw.none? do |code_element| if code_argument.is_a?(Function) code_argument .call( arguments: List.new([code_element, Integer.new(index), self]), **globals ) .truthy? .tap { index += 1 } elsif code_argument.is_a?(Class) code_element.is_a?(code_argument.raw).tap { index += 1 } else true.tap { index += 1 } end rescue Error::Next => e e.code_value.truthy?.tap { index += 1 } end ) rescue Error::Break => e e.code_value end |
#code_nth(index) ⇒ Object
3798 3799 3800 |
# File 'lib/code/object/list.rb', line 3798 def code_nth(index) raw[index] || Nothing.new end |
#code_one_hundredth ⇒ Object
4194 4195 4196 |
# File 'lib/code/object/list.rb', line 4194 def code_one_hundredth code_nth(99) end |
#code_partition(argument, **globals) ⇒ Object
4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 |
# File 'lib/code/object/list.rb', line 4617 def code_partition(argument, **globals) code_argument = argument.to_code lists = raw.partition.with_index do |code_element, index| if code_argument.is_a?(Function) code_argument.call( arguments: List.new([code_element, Integer.new(index), self]), **globals ).truthy? elsif code_argument.is_a?(Class) code_element.is_a?(code_argument.raw) else false end rescue Error::Next => e e.code_value.truthy? end List.new(lists.map { |list| List.new(list) }) rescue Error::Break => e e.code_value end |
#code_permutation(size = nil) ⇒ Object
4683 4684 4685 4686 4687 4688 |
# File 'lib/code/object/list.rb', line 4683 def code_permutation(size = nil) code_size = size.to_code size = code_size.nothing? ? raw.size : code_size.raw List.new(raw.permutation(size).map { |values| List.new(values) }) end |
#code_plus(other) ⇒ Object
3662 3663 3664 3665 3666 |
# File 'lib/code/object/list.rb', line 3662 def code_plus(other) code_other = other.to_code List.new(raw + code_other.raw) end |
#code_pop(n = nil) ⇒ Object
4289 4290 4291 4292 4293 4294 |
# File 'lib/code/object/list.rb', line 4289 def code_pop(n = nil) code_n = n.to_code n = code_n.raw code_n.nothing? ? raw.dup.pop || Nothing.new : List.new(raw.dup.pop(n)) end |
#code_pop!(n = nil) ⇒ Object
4296 4297 4298 4299 4300 4301 |
# File 'lib/code/object/list.rb', line 4296 def code_pop!(n = nil) code_n = n.to_code n = code_n.raw code_n.nothing? ? raw.pop || Nothing.new : List.new(raw.pop(n)) end |
#code_prepend(other) ⇒ Object
3628 3629 3630 3631 3632 |
# File 'lib/code/object/list.rb', line 3628 def code_prepend(other) code_other = other.to_code raw.unshift(code_other) self end |
#code_product(*lists) ⇒ Object
4690 4691 4692 4693 4694 4695 4696 4697 4698 |
# File 'lib/code/object/list.rb', line 4690 def code_product(*lists) code_lists = lists.to_code List.new( raw .product(*code_lists.raw.map(&:raw)) .map { |values| List.new(values) } ) end |
#code_push(other) ⇒ Object
3624 3625 3626 |
# File 'lib/code/object/list.rb', line 3624 def code_push(other) code_append(other) end |
#code_reduce(argument = nil, **globals) ⇒ Object
4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 |
# File 'lib/code/object/list.rb', line 4569 def code_reduce(argument = nil, **globals) code_argument = argument.to_code index = 0 raw.reduce do |code_acc, code_element| if code_argument.is_a?(Function) code_argument .call( arguments: List.new([code_acc, code_element, Integer.new(index), self]), **globals ) .tap { index += 1 } else code_acc.tap { index += 1 } end rescue Error::Next => e e.code_value.tap { index += 1 } end || Nothing.new rescue Error::Break => e e.code_value end |
#code_reject(argument = nil, **globals) ⇒ Object
4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 |
# File 'lib/code/object/list.rb', line 4892 def code_reject(argument = nil, **globals) code_argument = argument.to_code List.new( raw.reject.with_index do |code_element, index| if code_argument.is_a?(Function) code_argument.call( arguments: List.new([code_element, Integer.new(index), self]), **globals ).truthy? elsif code_argument.is_a?(Class) code_element.is_a?(code_argument.raw) else false end rescue Error::Next => e e.code_value.truthy? end ) rescue Error::Break => e e.code_value end |
#code_reject!(argument = nil, **globals) ⇒ Object
4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 |
# File 'lib/code/object/list.rb', line 4915 def code_reject!(argument = nil, **globals) code_argument = argument.to_code raw.reject!.with_index do |code_element, index| if code_argument.is_a?(Function) code_argument.call( arguments: List.new([code_element, Integer.new(index), self]), **globals ).truthy? elsif code_argument.is_a?(Class) code_element.is_a?(code_argument.raw) else false end rescue Error::Next => e e.code_value.truthy? end self rescue Error::Break => e e.code_value end |
#code_repeated_combination(size) ⇒ Object
4700 4701 4702 4703 4704 4705 4706 4707 4708 |
# File 'lib/code/object/list.rb', line 4700 def code_repeated_combination(size) code_size = size.to_code List.new( raw .repeated_combination(code_size.raw) .map { |values| List.new(values) } ) end |
#code_repeated_permutation(size) ⇒ Object
4710 4711 4712 4713 4714 4715 4716 4717 4718 |
# File 'lib/code/object/list.rb', line 4710 def code_repeated_permutation(size) code_size = size.to_code List.new( raw .repeated_permutation(code_size.raw) .map { |values| List.new(values) } ) end |
#code_reverse ⇒ Object
4720 4721 4722 |
# File 'lib/code/object/list.rb', line 4720 def code_reverse List.new(raw.reverse) end |
#code_reverse! ⇒ Object
4724 4725 4726 4727 |
# File 'lib/code/object/list.rb', line 4724 def code_reverse! raw.reverse! self end |
#code_reverse_each(argument, **globals) ⇒ Object
4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 |
# File 'lib/code/object/list.rb', line 4729 def code_reverse_each(argument, **globals) code_argument = argument.to_code raw.reverse_each.with_index do |code_element, index| code_argument.call( arguments: List.new([code_element, Integer.new(index), self]), **globals ) rescue Error::Next => e e.code_value end self rescue Error::Break => e e.code_value end |
#code_right_associate(value) ⇒ Object
4786 4787 4788 4789 4790 4791 4792 4793 4794 |
# File 'lib/code/object/list.rb', line 4786 def code_right_associate(value) code_value = value.to_code pair = raw.detect do |element| element.is_a?(List) && element.raw.second == code_value end pair || Nothing.new end |
#code_right_index(argument = nil, **globals) ⇒ Object
3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 |
# File 'lib/code/object/list.rb', line 3722 def code_right_index(argument = nil, **globals) code_argument = argument.to_code if code_argument.nothing? return Nothing.new elsif code_argument.is_a?(Function) index = raw.rindex.with_index do |code_element, index| code_argument.call( arguments: List.new([code_element, Integer.new(index), self]), **globals ).truthy? rescue Error::Next => e e.code_value.truthy? end elsif code_argument.is_a?(Class) index = raw.rindex { |code_element| code_element.is_a?(code_argument.raw) } else index = raw.rindex(code_argument) end index.nil? ? Nothing.new : Integer.new(index) rescue Error::Break => e e.code_value end |
#code_rotate(count = nil) ⇒ Object
4746 4747 4748 4749 4750 4751 |
# File 'lib/code/object/list.rb', line 4746 def code_rotate(count = nil) code_count = count.to_code code_count = Integer.new(1) if code_count.nothing? List.new(raw.rotate(code_count.raw)) end |
#code_rotate!(count = nil) ⇒ Object
4753 4754 4755 4756 |
# File 'lib/code/object/list.rb', line 4753 def code_rotate!(count = nil) self.raw = code_rotate(count).raw self end |
#code_sample(value = nil) ⇒ Object
4198 4199 4200 4201 4202 4203 4204 4205 4206 |
# File 'lib/code/object/list.rb', line 4198 def code_sample(value = nil) code_value = value.to_code if code_value.nothing? raw.sample || Nothing.new else List.new(raw.sample(code_value.raw)) end end |
#code_second ⇒ Object
3802 3803 3804 |
# File 'lib/code/object/list.rb', line 3802 def code_second code_nth(1) end |
#code_select(argument = nil, **globals) ⇒ Object
4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 |
# File 'lib/code/object/list.rb', line 4846 def code_select(argument = nil, **globals) code_argument = argument.to_code List.new( raw.select.with_index do |code_element, index| if code_argument.is_a?(Function) code_argument.call( arguments: List.new([code_element, Integer.new(index), self]), **globals ).truthy? elsif code_argument.is_a?(Class) code_element.is_a?(code_argument.raw) else false end rescue Error::Next => e e.code_value.truthy? end ) rescue Error::Break => e e.code_value end |
#code_select!(argument = nil, **globals) ⇒ Object
4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 |
# File 'lib/code/object/list.rb', line 4869 def code_select!(argument = nil, **globals) code_argument = argument.to_code raw.select!.with_index do |code_element, index| if code_argument.is_a?(Function) code_argument.call( arguments: List.new([code_element, Integer.new(index), self]), **globals ).truthy? elsif code_argument.is_a?(Class) code_element.is_a?(code_argument.raw) else false end rescue Error::Next => e e.code_value.truthy? end self rescue Error::Break => e e.code_value end |
#code_set(key, value) ⇒ Object
5129 5130 5131 5132 5133 5134 5135 5136 |
# File 'lib/code/object/list.rb', line 5129 def code_set(key, value) code_key = key.to_code return super unless code_key.is_a?(Integer) code_value = value.to_code raw[code_key.code_to_integer.raw] = code_value code_value end |
#code_seventeenth ⇒ Object
3862 3863 3864 |
# File 'lib/code/object/list.rb', line 3862 def code_seventeenth code_nth(16) end |
#code_seventh ⇒ Object
3822 3823 3824 |
# File 'lib/code/object/list.rb', line 3822 def code_seventh code_nth(6) end |
#code_seventieth ⇒ Object
4074 4075 4076 |
# File 'lib/code/object/list.rb', line 4074 def code_seventieth code_nth(69) end |
#code_seventy_eighth ⇒ Object
4106 4107 4108 |
# File 'lib/code/object/list.rb', line 4106 def code_seventy_eighth code_nth(77) end |
#code_seventy_fifth ⇒ Object
4094 4095 4096 |
# File 'lib/code/object/list.rb', line 4094 def code_seventy_fifth code_nth(74) end |
#code_seventy_first ⇒ Object
4078 4079 4080 |
# File 'lib/code/object/list.rb', line 4078 def code_seventy_first code_nth(70) end |
#code_seventy_fourth ⇒ Object
4090 4091 4092 |
# File 'lib/code/object/list.rb', line 4090 def code_seventy_fourth code_nth(73) end |
#code_seventy_ninth ⇒ Object
4110 4111 4112 |
# File 'lib/code/object/list.rb', line 4110 def code_seventy_ninth code_nth(78) end |
#code_seventy_second ⇒ Object
4082 4083 4084 |
# File 'lib/code/object/list.rb', line 4082 def code_seventy_second code_nth(71) end |
#code_seventy_seventh ⇒ Object
4102 4103 4104 |
# File 'lib/code/object/list.rb', line 4102 def code_seventy_seventh code_nth(76) end |
#code_seventy_sixth ⇒ Object
4098 4099 4100 |
# File 'lib/code/object/list.rb', line 4098 def code_seventy_sixth code_nth(75) end |
#code_seventy_third ⇒ Object
4086 4087 4088 |
# File 'lib/code/object/list.rb', line 4086 def code_seventy_third code_nth(72) end |
#code_shift(n = nil) ⇒ Object
4303 4304 4305 4306 4307 4308 |
# File 'lib/code/object/list.rb', line 4303 def code_shift(n = nil) code_n = n.to_code n = code_n.raw code_n.nothing? ? raw.shift || Nothing.new : List.new(raw.shift(n)) end |
#code_shuffle ⇒ Object
4208 4209 4210 |
# File 'lib/code/object/list.rb', line 4208 def code_shuffle List.new(raw.shuffle) end |
#code_shuffle! ⇒ Object
4212 4213 4214 4215 |
# File 'lib/code/object/list.rb', line 4212 def code_shuffle! raw.shuffle! self end |
#code_sixteenth ⇒ Object
3858 3859 3860 |
# File 'lib/code/object/list.rb', line 3858 def code_sixteenth code_nth(15) end |
#code_sixth ⇒ Object
3818 3819 3820 |
# File 'lib/code/object/list.rb', line 3818 def code_sixth code_nth(5) end |
#code_sixtieth ⇒ Object
4034 4035 4036 |
# File 'lib/code/object/list.rb', line 4034 def code_sixtieth code_nth(59) end |
#code_sixty_eighth ⇒ Object
4066 4067 4068 |
# File 'lib/code/object/list.rb', line 4066 def code_sixty_eighth code_nth(67) end |
#code_sixty_fifth ⇒ Object
4054 4055 4056 |
# File 'lib/code/object/list.rb', line 4054 def code_sixty_fifth code_nth(64) end |
#code_sixty_first ⇒ Object
4038 4039 4040 |
# File 'lib/code/object/list.rb', line 4038 def code_sixty_first code_nth(60) end |
#code_sixty_fourth ⇒ Object
4050 4051 4052 |
# File 'lib/code/object/list.rb', line 4050 def code_sixty_fourth code_nth(63) end |
#code_sixty_ninth ⇒ Object
4070 4071 4072 |
# File 'lib/code/object/list.rb', line 4070 def code_sixty_ninth code_nth(68) end |
#code_sixty_second ⇒ Object
4042 4043 4044 |
# File 'lib/code/object/list.rb', line 4042 def code_sixty_second code_nth(61) end |
#code_sixty_seventh ⇒ Object
4062 4063 4064 |
# File 'lib/code/object/list.rb', line 4062 def code_sixty_seventh code_nth(66) end |
#code_sixty_sixth ⇒ Object
4058 4059 4060 |
# File 'lib/code/object/list.rb', line 4058 def code_sixty_sixth code_nth(65) end |
#code_sixty_third ⇒ Object
4046 4047 4048 |
# File 'lib/code/object/list.rb', line 4046 def code_sixty_third code_nth(62) end |
#code_size ⇒ Object
4974 4975 4976 |
# File 'lib/code/object/list.rb', line 4974 def code_size Integer.new(raw.size) end |
#code_slice(*arguments) ⇒ Object
5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 |
# File 'lib/code/object/list.rb', line 5087 def code_slice(*arguments) code_arguments = arguments.to_code.raw if code_arguments.first.is_a?(Range) range = code_arguments.first value = raw.slice( ::Range.new( range.code_left.to_i, range.code_right.to_i, range.exclude_end? ) ) return value.is_a?(::Array) ? List.new(value) : value.to_code end value = raw.slice(*code_arguments.map(&:raw)) value.is_a?(::Array) ? List.new(value) : value.to_code end |
#code_slice!(*arguments) ⇒ Object
5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 |
# File 'lib/code/object/list.rb', line 5108 def code_slice!(*arguments) code_arguments = arguments.to_code.raw if code_arguments.first.is_a?(Range) range = code_arguments.first value = raw.slice!( ::Range.new( range.code_left.to_i, range.code_right.to_i, range.exclude_end? ) ) return value.is_a?(::Array) ? List.new(value) : value.to_code end value = raw.slice!(*code_arguments.map(&:raw)) value.is_a?(::Array) ? List.new(value) : value.to_code end |
#code_sort(argument = nil, **globals) ⇒ Object
4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 |
# File 'lib/code/object/list.rb', line 4944 def code_sort(argument = nil, **globals) code_argument = argument.to_code List.new( raw.sort_by.with_index do |code_element, index| if code_argument.is_a?(Function) code_argument.call( arguments: List.new([code_element, Integer.new(index), self]), **globals ) else code_element end rescue Error::Next => e e.code_value end ) rescue Error::Break => e e.code_value end |
#code_sort!(argument = nil, **globals) ⇒ Object
4965 4966 4967 4968 |
# File 'lib/code/object/list.rb', line 4965 def code_sort!(argument = nil, **globals) self.raw = code_sort(argument, **globals).raw self end |
#code_sort_by!(argument = nil, **globals) ⇒ Object
4970 4971 4972 |
# File 'lib/code/object/list.rb', line 4970 def code_sort_by!(argument = nil, **globals) code_sort!(argument, **globals) end |
#code_sum ⇒ Object
5059 5060 5061 |
# File 'lib/code/object/list.rb', line 5059 def code_sum raw.inject(&:code_plus) || Nothing.new end |
#code_take(n) ⇒ Object
4320 4321 4322 4323 |
# File 'lib/code/object/list.rb', line 4320 def code_take(n) code_n = n.to_code List.new(raw.take(code_n.raw)) end |
#code_take_while(argument, **globals) ⇒ Object
4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 |
# File 'lib/code/object/list.rb', line 4351 def code_take_while(argument, **globals) code_argument = argument.to_code List.new( raw.take_while.with_index do |code_element, index| if code_argument.is_a?(Class) code_element.is_a?(code_argument.raw) else code_argument.call( arguments: List.new([code_element, Integer.new(index), self]), **globals ).truthy? end rescue Error::Next => e e.code_value.truthy? end ) rescue Error::Break => e e.code_value end |
#code_tally ⇒ Object
5013 5014 5015 |
# File 'lib/code/object/list.rb', line 5013 def code_tally Dictionary.new(raw.tally) end |
#code_tenth ⇒ Object
3834 3835 3836 |
# File 'lib/code/object/list.rb', line 3834 def code_tenth code_nth(9) end |
#code_third ⇒ Object
3806 3807 3808 |
# File 'lib/code/object/list.rb', line 3806 def code_third code_nth(2) end |
#code_thirteenth ⇒ Object
3846 3847 3848 |
# File 'lib/code/object/list.rb', line 3846 def code_thirteenth code_nth(12) end |
#code_thirtieth ⇒ Object
3914 3915 3916 |
# File 'lib/code/object/list.rb', line 3914 def code_thirtieth code_nth(29) end |
#code_thirty_eighth ⇒ Object
3946 3947 3948 |
# File 'lib/code/object/list.rb', line 3946 def code_thirty_eighth code_nth(37) end |
#code_thirty_fifth ⇒ Object
3934 3935 3936 |
# File 'lib/code/object/list.rb', line 3934 def code_thirty_fifth code_nth(34) end |
#code_thirty_first ⇒ Object
3918 3919 3920 |
# File 'lib/code/object/list.rb', line 3918 def code_thirty_first code_nth(30) end |
#code_thirty_fourth ⇒ Object
3930 3931 3932 |
# File 'lib/code/object/list.rb', line 3930 def code_thirty_fourth code_nth(33) end |
#code_thirty_ninth ⇒ Object
3950 3951 3952 |
# File 'lib/code/object/list.rb', line 3950 def code_thirty_ninth code_nth(38) end |
#code_thirty_second ⇒ Object
3922 3923 3924 |
# File 'lib/code/object/list.rb', line 3922 def code_thirty_second code_nth(31) end |
#code_thirty_seventh ⇒ Object
3942 3943 3944 |
# File 'lib/code/object/list.rb', line 3942 def code_thirty_seventh code_nth(36) end |
#code_thirty_sixth ⇒ Object
3938 3939 3940 |
# File 'lib/code/object/list.rb', line 3938 def code_thirty_sixth code_nth(35) end |
#code_thirty_third ⇒ Object
3926 3927 3928 |
# File 'lib/code/object/list.rb', line 3926 def code_thirty_third code_nth(32) end |
#code_to_dictionary ⇒ Object
5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 |
# File 'lib/code/object/list.rb', line 5145 def code_to_dictionary Dictionary.new( raw.map.with_index.to_h do |element, index| if element.is_a?(List) && element.raw.many? [element.raw.first, element.raw.second] else [Integer.new(index), element] end end ) end |
#code_transpose ⇒ Object
4672 4673 4674 |
# File 'lib/code/object/list.rb', line 4672 def code_transpose List.new(raw.map(&:raw).transpose) end |
#code_twelfth ⇒ Object
3842 3843 3844 |
# File 'lib/code/object/list.rb', line 3842 def code_twelfth code_nth(11) end |
#code_twentieth ⇒ Object
3874 3875 3876 |
# File 'lib/code/object/list.rb', line 3874 def code_twentieth code_nth(19) end |
#code_twenty_eighth ⇒ Object
3906 3907 3908 |
# File 'lib/code/object/list.rb', line 3906 def code_twenty_eighth code_nth(27) end |
#code_twenty_fifth ⇒ Object
3894 3895 3896 |
# File 'lib/code/object/list.rb', line 3894 def code_twenty_fifth code_nth(24) end |
#code_twenty_first ⇒ Object
3878 3879 3880 |
# File 'lib/code/object/list.rb', line 3878 def code_twenty_first code_nth(20) end |
#code_twenty_fourth ⇒ Object
3890 3891 3892 |
# File 'lib/code/object/list.rb', line 3890 def code_twenty_fourth code_nth(23) end |
#code_twenty_ninth ⇒ Object
3910 3911 3912 |
# File 'lib/code/object/list.rb', line 3910 def code_twenty_ninth code_nth(28) end |
#code_twenty_second ⇒ Object
3882 3883 3884 |
# File 'lib/code/object/list.rb', line 3882 def code_twenty_second code_nth(21) end |
#code_twenty_seventh ⇒ Object
3902 3903 3904 |
# File 'lib/code/object/list.rb', line 3902 def code_twenty_seventh code_nth(26) end |
#code_twenty_sixth ⇒ Object
3898 3899 3900 |
# File 'lib/code/object/list.rb', line 3898 def code_twenty_sixth code_nth(25) end |
#code_twenty_third ⇒ Object
3886 3887 3888 |
# File 'lib/code/object/list.rb', line 3886 def code_twenty_third code_nth(22) end |
#code_union(*lists) ⇒ Object
4758 4759 4760 |
# File 'lib/code/object/list.rb', line 4758 def code_union(*lists) List.new(raw.union(*lists.to_code.raw.map(&:raw))) end |
#code_uniq(argument = nil, **globals) ⇒ Object
5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 |
# File 'lib/code/object/list.rb', line 5021 def code_uniq(argument = nil, **globals) code_argument = argument.to_code unless code_argument.is_a?(Function) || code_argument.is_a?(Class) return List.new(raw.uniq) end if code_argument.is_a?(Class) return List.new(raw.grep(code_argument.raw).uniq) end index = 0 List.new( raw.uniq do |code_element| if code_argument.is_a?(Function) code_argument .call( arguments: List.new([code_element, Integer.new(index), self]), **globals ) .tap { index += 1 } else code_element.tap { index += 1 } end rescue Error::Next => e e.code_value.tap { index += 1 } end ) rescue Error::Break => e e.code_value end |
#code_uniq!(argument = nil, **globals) ⇒ Object
5054 5055 5056 5057 |
# File 'lib/code/object/list.rb', line 5054 def code_uniq!(argument = nil, **globals) self.raw = code_uniq(argument, **globals).raw self end |
#code_values_at(*indices) ⇒ Object
5081 5082 5083 5084 5085 |
# File 'lib/code/object/list.rb', line 5081 def code_values_at(*indices) code_indices = indices.to_code List.new(raw.values_at(*code_indices.raw.map(&:raw))) end |
#code_zip(*arguments) ⇒ Object
4372 4373 4374 4375 |
# File 'lib/code/object/list.rb', line 4372 def code_zip(*arguments) code_arguments = arguments.to_code List.new(raw.zip(*code_arguments.raw.map(&:raw))) end |
#present? ⇒ Boolean
5161 5162 5163 |
# File 'lib/code/object/list.rb', line 5161 def present? raw.present? end |