Module: Tins::ProcPrelude

### Home Classes Methods

### In Files

- lib/tins/proc_prelude.rb

### Methods

- #apply
- #array
- #call
- #const
- #first
- #from
- #head
- #id1
- #last
- #map_apply
- #nth
- #rotate
- #second
- #swap
- #tail

### Class/Module Index

Quicksearch

- Tins
- Tins
- Tins
- Tins::Annotate
- Tins::AskAndSend
- Tins::Attempt
- Tins::Bijection
- Tins::Blank
- Tins::Blank::Array
- Tins::Blank::FalseClass
- Tins::Blank::Hash
- Tins::Blank::NilClass
- Tins::Blank::Numeric
- Tins::Blank::Object
- Tins::Blank::String
- Tins::Blank::TrueClass
- Tins::BlankSlate
- Tins::BlockSelf
- Tins::CasePredicate
- Tins::ClassMethod
- Tins::Concern
- Tins::Concern::ModuleMixin
- Tins::Constant
- Tins::ConstantMaker
- Tins::CountBy
- Tins::DSLAccessor
- Tins::DateDummy
- Tins::DateTimeDummy
- Tins::DeepConstGet
- Tins::DeepDup
- Tins::Deflect
- Tins::Deflect::DeflectError
- Tins::Deflect::Deflector
- Tins::Deflect::DeflectorCollection
- Tins::Delegate
- Tins::DynamicScope
- Tins::DynamicScope::Context
- Tins::Eigenclass
- Tins::ExtractLastArgumentOptions
- Tins::FileBinary
- Tins::FileBinary::ClassMethods
- Tins::FileBinary::Constants
- Tins::Find
- Tins::Find::Finder
- Tins::Find::Finder::PathExtension
- Tins::FromModule
- Tins::Full
- Tins::GO
- Tins::GO::EnumerableExtension
- Tins::Generator
- Tins::HashSymbolizeKeysRecursive
- Tins::HashUnion
- Tins::IfPredicate
- Tins::InstanceExec
- Tins::Interpreter
- Tins::Limited
- Tins::LinesFile
- Tins::LinesFile::LineExtension
- Tins::Memoize
- Tins::Memoize::CacheMethods
- Tins::MethodDescription
- Tins::MethodMissingDelegator
- Tins::MethodMissingDelegator::DelegatorClass
- Tins::MethodMissingDelegator::DelegatorModule
- Tins::Minimize
- Tins::ModuleGroup
- Tins::NamedSet
- Tins::Null
- Tins::Null::Kernel
- Tins::NullClass
- Tins::NullPlus
- Tins::Once
- Tins::P
- Tins::ParameterizedModule
- Tins::PartialApplication
- Tins::ProcCompose
- Tins::ProcPrelude
- Tins::RangePlus
- Tins::RequireMaybe
- Tins::Responding
- Tins::Rotate
- Tins::Scope
- Tins::SecureWrite
- Tins::SexySingleton
- Tins::SexySingleton::SingletonClassMethods
- Tins::Shuffle
- Tins::StringByteOrderMark
- Tins::StringCamelize
- Tins::StringUnderscore
- Tins::StringVersion
- Tins::StringVersion::Version
- Tins::Subhash
- Tins::SymbolMaker
- Tins::Terminal
- Tins::ThreadGlobal
- Tins::ThreadLocal
- Tins::TimeDummy
- Tins::TimeFreezer
- Tins::To
- Tins::ToProc
- Tins::Token
- Tins::UniqBy
- Tins::Write
- Object
- Object::DSLKit
- Object::Spruz
- Array
- Date
- DateTime
- Enumerable
- File
- Hash
- IO
- IRB
- Method
- Module
- Proc
- Range
- String
- Symbol
- Time
- UnboundMethod

No matching classes.

# Tins::ProcPrelude

### Public Instance Methods

apply(&my_proc) click to toggle source

    # File lib/tins/proc_prelude.rb, line 5
    def apply(&my_proc)
      my_proc or raise ArgumentError, 'a block argument is required'
      lambda { |list| my_proc.call(*list) }
    end

array() click to toggle source

    # File lib/tins/proc_prelude.rb, line 20
    def array
      lambda { |*list| list }
    end

call(obj, &my_proc) click to toggle source

    # File lib/tins/proc_prelude.rb, line 15
    def call(obj, &my_proc)
      my_proc or raise ArgumentError, 'a block argument is required'
      obj.instance_eval(&my_proc)
    end

const(konst = nil, &my_proc) click to toggle source

    # File lib/tins/proc_prelude.rb, line 58
    def const(konst = nil, &my_proc)
      konst ||= my_proc.call
      lambda { |*_| konst }
    end

first() click to toggle source

    # File lib/tins/proc_prelude.rb, line 25
    def first
      lambda { |*list| list.first }
    end

Also aliased as: head
from(&block) click to toggle source

    # File lib/tins/proc_prelude.rb, line 67
    def from(&block)
      my_method, binding = block.call, block.binding
      my_self = eval 'self', binding
      lambda { |*list| my_self.__send__(my_method, *list) }
    end

head() click to toggle source
Alias for: first
id1() click to toggle source

    # File lib/tins/proc_prelude.rb, line 53
    def id1
      lambda { |obj| obj }
    end

last() click to toggle source

    # File lib/tins/proc_prelude.rb, line 42
    def last
      lambda { |*list| list.last }
    end

map_apply(my_method, *args, &my_proc) click to toggle source

    # File lib/tins/proc_prelude.rb, line 10
    def map_apply(my_method, *args, &my_proc)
      my_proc or raise ArgumentError, 'a block argument is required'
      lambda { |x, y| my_proc.call(x, y.__send__(my_method, *args)) }
    end

nth(n) click to toggle source

    # File lib/tins/proc_prelude.rb, line 63
    def nth(n)
      lambda { |*list| list[n] }
    end

rotate(n = 1) click to toggle source

    # File lib/tins/proc_prelude.rb, line 47
    def rotate(n = 1)
      lambda { |*list| list.rotate(n) }
    end

Also aliased as: swap
second() click to toggle source

    # File lib/tins/proc_prelude.rb, line 32
    def second
      lambda { |*list| list[1] }
    end

swap(n = 1) click to toggle source
Alias for: rotate
tail() click to toggle source

    # File lib/tins/proc_prelude.rb, line 37
    def tail
      lambda { |*list| list[1..-1] }
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.