All Projects → ruby-ee → ruby-stream-api

ruby-ee / ruby-stream-api

Licence: BSD-3-Clause license
Ruby Stream API. Inspired by Java 8's Stream API.

Programming Languages

ruby
36898 projects - #4 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to ruby-stream-api

matrixone
Hyperconverged cloud-edge native database
Stars: ✭ 1,057 (+4933.33%)
Mutual labels:  streaming
SimpleRemoteDesktop
Remote desktop client based on h264 steam. like splashtop and other
Stars: ✭ 17 (-19.05%)
Mutual labels:  streaming
jmix-core
Jmix framework
Stars: ✭ 201 (+857.14%)
Mutual labels:  enterprise
ruby attic
💍 Unmaintained ruby projects needing people!
Stars: ✭ 26 (+23.81%)
Mutual labels:  rubygem
LazyMan-iOS
A simple app that lets you stream every live and archived NHL and MLB game from any of your iOS devices.
Stars: ✭ 73 (+247.62%)
Mutual labels:  streaming
streamdvr
DVR for streaming entertainment
Stars: ✭ 51 (+142.86%)
Mutual labels:  streaming
WorkGroup
Self-Hosted private Social Media-Intranet for Companies.
Stars: ✭ 21 (+0%)
Mutual labels:  enterprise
minitest-matchers vaccine
💉 Adds matcher support to minitest without all the other RSpec-style expectation "infections."
Stars: ✭ 33 (+57.14%)
Mutual labels:  rubygem
modular routes
Dedicated controllers for each of your Rails route actions.
Stars: ✭ 45 (+114.29%)
Mutual labels:  rubygem
HJPlayer
A HTML5 Player, can play flv and hls by Media Source Extension, based on typescript.
Stars: ✭ 149 (+609.52%)
Mutual labels:  streaming
bootswatch-sass
bootswatch ruby gems for assets pipeline
Stars: ✭ 12 (-42.86%)
Mutual labels:  rubygem
live-cryptocurrency-streaming-flutter
A Flutter app with live cryptocurrency updates, powered by Ably
Stars: ✭ 26 (+23.81%)
Mutual labels:  streaming
consul-templaterb
consul-template-like with erb (ruby) template expressiveness
Stars: ✭ 65 (+209.52%)
Mutual labels:  rubygem
qubes-video-companion
Securely stream webcams and share screens across virtual machines *THIS PROJECT IS CURRENTLY STILL IN DEVELOPMENT (Mostly finishing switch to MJPEG for big performance boost; see FAQ)*
Stars: ✭ 38 (+80.95%)
Mutual labels:  streaming
React-Redux-Enterprise
A React-Redux boilerplate for enterprise/large scaled web applications
Stars: ✭ 77 (+266.67%)
Mutual labels:  enterprise
meza
Setup an enterprise MediaWiki server with simple commands
Stars: ✭ 38 (+80.95%)
Mutual labels:  enterprise
libdvbtee
dvbtee: a digital television streamer / parser / service information aggregator supporting various interfaces including telnet CLI & http control
Stars: ✭ 65 (+209.52%)
Mutual labels:  streaming
piranha
Piranha - a modern cloud runtime
Stars: ✭ 136 (+547.62%)
Mutual labels:  enterprise
StarCraft-Casting-Tool
StarCraft Casting Tool is a free to use open source program that makes casting StarCraft 2 simple while increasing the production value substantially by providing a match grabber and various sets of animated icons and browser sources to be shown to the viewer.
Stars: ✭ 17 (-19.05%)
Mutual labels:  streaming
Spark
Apache Spark is a fast, in-memory data processing engine with elegant and expressive development API's to allow data workers to efficiently execute streaming, machine learning or SQL workloads that require fast iterative access to datasets.This project will have sample programs for Spark in Scala language .
Stars: ✭ 55 (+161.9%)
Mutual labels:  streaming

Ruby Stream API

Gem Version Build Status Test Coverage

DevOps By Rultor.com We recommend RubyMine

A Stream is a wrapper over a collection of elements offering a number of useful operations to modify and/or get information about the collection. The operations are chainable and can be categorized as follows:

  • Source operations -- these are the operations which are generating the Stream.
  • Intermediate operations (skip, filter, map etc) -- operations which are altering the Stream and still leave it open for further modifications.
  • Terminal operations (count, collect etc) -- operations which are executed after all the modifications have been done and are returning a finite result.

First glance:

  1. Finite Stream from an array:
array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
stream = Stream::FromArray.new(array)
collected = stream
    .filter { |num| num % 2 == 0 }
    .skip(2)
    .collect
puts collected # [6, 8, 10]
  1. Generate a (potentially) infinite stream:
stream = Stream.generate(150) { &seed }

The generate method takes a limit (max number of elements) and a &seed Block function which returns a new element at each seed.call. A limit is necessary as, without it, this Stream would be infinite. If no limit is specified, the default is 100 elements.

This mechanism is useful, for instance, when you have to consume an incomming stream of objects from some IO objects.

More info and methods' overview, in the Wiki.

Installation

Add this line to your application's Gemfile:

gem 'ruby-stream-api'

Or install it as a separate gem:

$gem install ruby-stream-api

To require it inside your Ruby program do:

require 'stream'

The latest version is 0.0.2.

Not a Mixin

This is not a Mixin! The Stream is a proper object wrapping your collection(s). Furthermore, each object in this gem is immutable and therefore thread-safe -> the intermediate operations are not altering the instance on which they are called; instead, they create a new instance of the Stream with a modified version of the underlying collection.

Contribute

If you would like to contribute, just open an Issue (bugs, feature requests, any improvement idea) or a PR.

In order to build the project, you need Bundler and Ruby >= 2.3.0.

Make sure the build passes:

$bundle install
$bundle exec rake
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].