Class: Lab42::Console::Wrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/lab42/console/wrapper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#functionObject (readonly)

Returns the value of attribute function.



6
7
8
# File 'lib/lab42/console/wrapper.rb', line 6

def function
  @function
end

#subjectObject (readonly)

Returns the value of attribute subject.



6
7
8
# File 'lib/lab42/console/wrapper.rb', line 6

def subject
  @subject
end

Instance Method Details

#add(*args, &blk) ⇒ Object



8
9
10
11
# File 'lib/lab42/console/wrapper.rb', line 8

def add(*args, &blk)
  @function = function.add(*args, &blk)
  self
end

#fnd(*args, &blk) ⇒ Object



14
15
16
17
18
# File 'lib/lab42/console/wrapper.rb', line 14

def fnd(*args, &blk)
  _apply_function
    .find{ |x| x.apply_to_cdr(_make_function(*args, &blk))&.cdr }
    &.car
end

#sel(*args, &blk) ⇒ Object



20
21
22
23
24
25
# File 'lib/lab42/console/wrapper.rb', line 20

def sel(*args, &blk)
  filter_function = _make_function(*args, &blk)
  _apply_function
    .filter{ |x| x.apply_to_cdr(filter_function)&.cdr }
    .map(&:car)
end