Module: Reacto

Defined in:
lib/reacto.rb,
lib/reacto/tracker.rb,
lib/reacto/version.rb,
lib/reacto/constants.rb,
lib/reacto/executors.rb,
lib/reacto/trackable.rb,
lib/reacto/behaviours.rb,
lib/reacto/cache/file.rb,
lib/reacto/cache/memory.rb,
lib/reacto/subscriptions.rb,
lib/reacto/operations/act.rb,
lib/reacto/operations/map.rb,
lib/reacto/operations/diff.rb,
lib/reacto/operations/drop.rb,
lib/reacto/operations/last.rb,
lib/reacto/operations/take.rb,
lib/reacto/operations/uniq.rb,
lib/reacto/operations/wrap.rb,
lib/reacto/operations/chunk.rb,
lib/reacto/operations/cycle.rb,
lib/reacto/operations/merge.rb,
lib/reacto/operations/retry.rb,
lib/reacto/operations/slice.rb,
lib/reacto/shared_trackable.rb,
lib/reacto/labeled_trackable.rb,
lib/reacto/operations/append.rb,
lib/reacto/operations/buffer.rb,
lib/reacto/operations/concat.rb,
lib/reacto/operations/inject.rb,
lib/reacto/operations/select.rb,
lib/reacto/operations/flatten.rb,
lib/reacto/operations/include.rb,
lib/reacto/operations/prepend.rb,
lib/reacto/operations/flat_map.rb,
lib/reacto/operations/throttle.rb,
lib/reacto/operations/track_on.rb,
lib/reacto/operations/depend_on.rb,
lib/reacto/operations/extremums.rb,
lib/reacto/operations/partition.rb,
lib/reacto/operations/delay_each.rb,
lib/reacto/operations/drop_while.rb,
lib/reacto/operations/find_index.rb,
lib/reacto/operations/retry_when.rb,
lib/reacto/operations/slice_when.rb,
lib/reacto/operations/take_while.rb,
lib/reacto/operations/chunk_while.rb,
lib/reacto/operations/drop_errors.rb,
lib/reacto/operations/each_collect.rb,
lib/reacto/operations/split_labeled.rb,
lib/reacto/operations/group_by_label.rb,
lib/reacto/resources/shared_resource.rb,
lib/reacto/operations/flat_map_latest.rb,
lib/reacto/operations/flatten_labeled.rb,
lib/reacto/subscriptions/subscription.rb,
lib/reacto/operations/each_with_object.rb,
lib/reacto/resources/executor_resource.rb,
lib/reacto/operations/blocking_enumerable.rb,
lib/reacto/operations/operation_on_labeled.rb,
lib/reacto/subscriptions/inner_subscription.rb,
lib/reacto/subscriptions/simple_subscription.rb,
lib/reacto/subscriptions/subscription_wrapper.rb,
lib/reacto/subscriptions/tracker_subscription.rb,
lib/reacto/subscriptions/zipping_subscription.rb,
lib/reacto/operations/rescue_and_replace_error.rb,
lib/reacto/subscriptions/buffered_subscription.rb,
lib/reacto/subscriptions/executor_subscription.rb,
lib/reacto/subscriptions/flat_map_subscription.rb,
lib/reacto/subscriptions/combining_subscription.rb,
lib/reacto/subscriptions/composite_subscription.rb,
lib/reacto/subscriptions/operation_subscription.rb,
lib/reacto/subscriptions/combining_last_subscription.rb

Defined Under Namespace

Modules: Behaviours, Cache, Executors, Operations, Resources, Subscriptions Classes: LabeledTrackable, SharedTrackable, Trackable, Tracker

Constant Summary collapse

VERSION =
'1.0.0'
NOTHING =
{}
NO_ACTION =
-> (*_args) {}
IDENTITY_ACTION =
-> (arg) { arg }
DEFAULT_ON_ERROR =
-> (e) { raise e }
ID =
-> (v) { v }
NO_VALUE =
{}
TRUE_PREDICATE =
-> (_val) { true }
FALSE_PREDICATE =
-> (_val) { false }

Class Method Summary collapse

Class Method Details

.[](object) ⇒ Object



67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/reacto.rb', line 67

def [](object)
  if object.is_a?(Enumerable)
    enumerable(object)
  elsif object.is_a?(StandardError)
    error(object)
  elsif object == :close
    close
  elsif object == :never || object.nil?
    never
  else
    value(object)
  end
end

.close(executor: nil) ⇒ Object



21
22
23
# File 'lib/reacto.rb', line 21

def close(executor: nil)
  Trackable.close(executor: executor)
end

.combine(*trackables, &block) ⇒ Object Also known as: combine_latest



51
52
53
# File 'lib/reacto.rb', line 51

def combine(*trackables, &block)
  Trackable.combine(*trackables, &block)
end

.combine_last(*trackables, &block) ⇒ Object



55
56
57
# File 'lib/reacto.rb', line 55

def combine_last(*trackables, &block)
  Trackable.combine_last(*trackables, &block)
end

.concat(*trackables) ⇒ Object



63
64
65
# File 'lib/reacto.rb', line 63

def concat(*trackables)
  Trackable.concat(*trackables)
end

.enumerable(enumerable, executor: nil) ⇒ Object



33
34
35
# File 'lib/reacto.rb', line 33

def enumerable(enumerable, executor: nil)
  Trackable.enumerable(enumerable, executor: executor)
end

.error(err, executor: nil) ⇒ Object



25
26
27
# File 'lib/reacto.rb', line 25

def error(err, executor: nil)
  Trackable.error(err, executor: executor)
end

.interval(interval, enumerator = Behaviours.integers_enumerator, executor: nil) ⇒ Object



41
42
43
44
45
# File 'lib/reacto.rb', line 41

def interval(
  interval, enumerator = Behaviours.integers_enumerator, executor: nil
)
  Trackable.interval(interval, enumerator, executor: executor)
end

.later(secs, value, executor: :tasks) ⇒ Object



37
38
39
# File 'lib/reacto.rb', line 37

def later(secs, value, executor: :tasks)
  Trackable.later(secs, value, executor: executor)
end

.make(executor_param = nil, executor: executor, &block) ⇒ Object



13
14
15
# File 'lib/reacto.rb', line 13

def make(executor_param = nil, executor: executor, &block)
  Trackable.make(executor_param, executor: executor, &block)
end

.neverObject



17
18
19
# File 'lib/reacto.rb', line 17

def never
  Trackable.never
end

.repeat(array, int: 0.1, executor: nil) ⇒ Object



47
48
49
# File 'lib/reacto.rb', line 47

def repeat(array, int: 0.1, executor: nil)
  Trackable.repeat(array, int: int, executor: executor)
end

.value(value, executor: nil) ⇒ Object



29
30
31
# File 'lib/reacto.rb', line 29

def value(value, executor: nil)
  Trackable.value(value, executor: executor)
end

.zip(*trackables, &block) ⇒ Object



59
60
61
# File 'lib/reacto.rb', line 59

def zip(*trackables, &block)
  Trackable.zip(*trackables, &block)
end