Skip to content

Commit

Permalink
Merge pull request #74 from minamimonji/change_project_name
Browse files Browse the repository at this point in the history
Change the project name and the module name from Rx.rb to RxRuby
  • Loading branch information
mattpodwysocki committed Dec 17, 2015
2 parents e493b32 + e64ef4b commit 8befc0b
Show file tree
Hide file tree
Showing 178 changed files with 675 additions and 676 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
source 'https://rubygems.org'

# Specify your gem's dependencies in Rx.rb.gemspec
# Specify your gem's dependencies in rx_ruby.gemspec
gemspec
6 changes: 3 additions & 3 deletions examples/aggregate.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'rx'
require 'rx_ruby'

# Using a seed for the accumulate
source = RX::Observable.range(1, 10).aggregate(1) {|acc, x|
source = RxRuby::Observable.range(1, 10).aggregate(1) {|acc, x|
acc * x
}

Expand All @@ -20,7 +20,7 @@
# => Completed

# Without a seed
source = RX::Observable.range(1, 10).aggregate {|acc, x|
source = RxRuby::Observable.range(1, 10).aggregate {|acc, x|
acc + x
}

Expand Down
8 changes: 4 additions & 4 deletions examples/amb.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
require 'rx'
require 'rx_ruby'

# Using Observable sequences
source = RX::Observable.amb(
RX::Observable.timer(0.5).map { 'foo' },
RX::Observable.timer(0.2).map { 'bar' }
source = RxRuby::Observable.amb(
RxRuby::Observable.timer(0.5).map { 'foo' },
RxRuby::Observable.timer(0.2).map { 'bar' }
)

subscription = source.subscribe(
Expand Down
6 changes: 3 additions & 3 deletions examples/ambproto.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'rx'
require 'rx_ruby'

first = RX::Observable.timer(0.3).map { 'first' }
second = RX::Observable.timer(0.5).map { 'second' }
first = RxRuby::Observable.timer(0.3).map { 'first' }
second = RxRuby::Observable.timer(0.5).map { 'second' }

source = first.amb(second)

Expand Down
8 changes: 4 additions & 4 deletions examples/and.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
require 'rx'
require 'rx_ruby'

# Choice of either plan, the first set of timers or second set
source = RX::Observable.when(
RX::Observable.timer(0.2).and(RX::Observable.timer(0.3)).then_do(lambda {|x, y| return 'first' }),
RX::Observable.timer(0.4).and(RX::Observable.timer(0.5)).then_do(lambda {|x, y| return 'second' }),
source = RxRuby::Observable.when(
RxRuby::Observable.timer(0.2).and(RxRuby::Observable.timer(0.3)).then_do(lambda {|x, y| return 'first' }),
RxRuby::Observable.timer(0.4).and(RxRuby::Observable.timer(0.5)).then_do(lambda {|x, y| return 'second' }),
)

subscription = source.subscribe(
Expand Down
4 changes: 2 additions & 2 deletions examples/as_observable.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'rx'
require 'rx_ruby'

# Create subject
subject = RX::AsyncSubject.new
subject = RxRuby::AsyncSubject.new

# Send a value
subject.on_next(42)
Expand Down
6 changes: 3 additions & 3 deletions examples/average.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'rx'
require 'rx_ruby'

# Without a selector
source = RX::Observable.range(0, 9).average
source = RxRuby::Observable.range(0, 9).average

subscription = source.subscribe(
lambda {|x|
Expand All @@ -24,7 +24,7 @@
{ value: 3 }
]

source = RX::Observable.from_array(arr).average {|x|
source = RxRuby::Observable.from_array(arr).average {|x|
x[:value]
}

Expand Down
6 changes: 3 additions & 3 deletions examples/buffer_with_count.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'rx'
require 'rx_ruby'

# Without a skip
source = RX::Observable.range(1, 6)
source = RxRuby::Observable.range(1, 6)
.buffer_with_count(2)

subscription = source.subscribe(
Expand All @@ -21,7 +21,7 @@
# => Completed

# Using a skip
source = RX::Observable.range(1, 6)
source = RxRuby::Observable.range(1, 6)
.buffer_with_count(2, 1)

subscription = source.subscribe(
Expand Down
6 changes: 3 additions & 3 deletions examples/buffer_with_time.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'rx'
require 'rx_ruby'

# Without a skip
source = RX::Observable.interval(0.1)
source = RxRuby::Observable.interval(0.1)
.buffer_with_time(0.5)
.take(3)

Expand All @@ -26,7 +26,7 @@
end

# Using a skip
source = RX::Observable.interval(0.1)
source = RxRuby::Observable.interval(0.1)
.buffer_with_time(0.5, 0.1)
.take(3)

Expand Down
10 changes: 5 additions & 5 deletions examples/case.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
require 'rx'
require 'rx_ruby'

sources = {
'foo' => RX::Observable.return(42),
'bar' => RX::Observable.return(56)
'foo' => RxRuby::Observable.return(42),
'bar' => RxRuby::Observable.return(56)
}

defaultSource = RX::Observable.empty()
defaultSource = RxRuby::Observable.empty()

source = RX::Observable.case(
source = RxRuby::Observable.case(
lambda {
'foo'
},
Expand Down
8 changes: 4 additions & 4 deletions examples/catch.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
require 'rx'
require 'rx_ruby'

obs1 = RX::Observable.raise_error(Exception.new('error'))
obs2 = RX::Observable.return(42)
obs1 = RxRuby::Observable.raise_error(Exception.new('error'))
obs2 = RxRuby::Observable.return(42)

source = RX::Observable.rescue_error(obs1, obs2)
source = RxRuby::Observable.rescue_error(obs1, obs2)

subscription = source.subscribe(
lambda {|x|
Expand Down
10 changes: 5 additions & 5 deletions examples/catchproto.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
require 'rx'
require 'rx_ruby'

# Using a second observable
source = RX::Observable.raise_error(Exception.new)
.rescue_error(RX::Observable.return(42))
source = RxRuby::Observable.raise_error(Exception.new)
.rescue_error(RxRuby::Observable.return(42))

subscription = source.subscribe(
lambda {|x|
Expand All @@ -19,9 +19,9 @@
# => Completed

# Using a handler function
source = RX::Observable.raise_error(Exception.new)
source = RxRuby::Observable.raise_error(Exception.new)
.rescue_error {|e|
RX::Observable.return(e.is_a? Exception)
RxRuby::Observable.return(e.is_a? Exception)
}

subscription = source.subscribe(
Expand Down
8 changes: 4 additions & 4 deletions examples/combine_latest.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
require 'rx'
require 'rx_ruby'

# Have staggering intervals
source1 = RX::Observable.interval(0.1)
source1 = RxRuby::Observable.interval(0.1)
.map {|i| 'First: ' + i.to_s }

source2 = RX::Observable.interval(0.15)
source2 = RxRuby::Observable.interval(0.15)
.map {|i| 'Second: ' + i.to_s }

# Combine latest of source1 and source2 whenever either gives a value
source = RX::Observable.combine_latest(
source = RxRuby::Observable.combine_latest(
source1,
source2) {|s1, s2| s1.to_s + ', ' + s2.to_s }
.take(4)
Expand Down
6 changes: 3 additions & 3 deletions examples/combine_latestproto.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
require 'rx'
require 'rx_ruby'

# Have staggering intervals
source1 = RX::Observable.interval(0.1)
source1 = RxRuby::Observable.interval(0.1)
.map {|i| 'First: ' + i.to_s }

source2 = RX::Observable.interval(0.15)
source2 = RxRuby::Observable.interval(0.15)
.map {|i| 'Second: ' + i.to_s }

# Combine latest of source1 and source2 whenever either gives a value
Expand Down
8 changes: 4 additions & 4 deletions examples/concat.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
require 'rx'
require 'rx_ruby'

# Using Observable sequences
source1 = RX::Observable.return(42)
source2 = RX::Observable.return(56)
source1 = RxRuby::Observable.return(42)
source2 = RxRuby::Observable.return(56)

source = RX::Observable.concat(source1, source2)
source = RxRuby::Observable.concat(source1, source2)

subscription = source.subscribe(
lambda {|x|
Expand Down
6 changes: 3 additions & 3 deletions examples/concat_all.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'rx'
require 'rx_ruby'

source = RX::Observable.range(0, 3)
.map {|x| RX::Observable.range(x, 3) }
source = RxRuby::Observable.range(0, 3)
.map {|x| RxRuby::Observable.range(x, 3) }
.concat_all

subscription = source.subscribe(
Expand Down
8 changes: 4 additions & 4 deletions examples/concat_map.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
require 'rx'
require 'rx_ruby'

source = RX::Observable.range(0, 5)
source = RxRuby::Observable.range(0, 5)
.concat_map(lambda {|x, i|
return RX::Observable
return RxRuby::Observable
.interval(0.1)
.take(x).map { i }
})
Expand Down Expand Up @@ -35,7 +35,7 @@
end

# Using an array
source = RX::Observable.of(1,2,3)
source = RxRuby::Observable.of(1,2,3)
.concat_map(
lambda {|x, i| return [x,i] },
lambda {|x, y, ix, iy| return x + y + ix + iy }
Expand Down
10 changes: 5 additions & 5 deletions examples/concat_map_observer.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
require 'rx'
require 'rx_ruby'

source = RX::Observable.range(1, 3)
source = RxRuby::Observable.range(1, 3)
.concat_map_observer(
lambda {|x, i|
return RX::Observable.repeat(x, i)
return RxRuby::Observable.repeat(x, i)
},
lambda {|err|
return RX::Observable.return(42)
return RxRuby::Observable.return(42)
},
lambda {
return RX::Observable.empty
return RxRuby::Observable.empty
})

subscription = source.subscribe(
Expand Down
6 changes: 3 additions & 3 deletions examples/concatproto.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
require 'rx'
require 'rx_ruby'

source = RX::Observable
source = RxRuby::Observable
.return(42)
.concat(RX::Observable.return(56), RX::Observable.return(72))
.concat(RxRuby::Observable.return(56), RxRuby::Observable.return(72))

subscription = source.subscribe(
lambda {|x|
Expand Down
6 changes: 3 additions & 3 deletions examples/connect.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
require 'rx'
require 'rx_ruby'

interval = RX::Observable.interval(1)
interval = RxRuby::Observable.interval(1)

source = interval
.take(2)
.do {|x| puts 'Side effect' }

def create_observer(tag)
return RX::Observer.create(
return RxRuby::Observer.create(
lambda {|x|
puts 'Next: ' + tag + x.to_s
},
Expand Down
6 changes: 3 additions & 3 deletions examples/contains.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'rx'
require 'rx_ruby'

# Without an index
source = RX::Observable.of(42)
source = RxRuby::Observable.of(42)
.contains(42)

subscription = source.subscribe(
Expand All @@ -19,7 +19,7 @@
# => Completed

# With an index
source = RX::Observable.of(1,2,3)
source = RxRuby::Observable.of(1,2,3)
.contains(2, 1)

subscription = source.subscribe(
Expand Down
6 changes: 3 additions & 3 deletions examples/count.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'rx'
require 'rx_ruby'

# Without a predicate
source = RX::Observable.range(0, 10).count
source = RxRuby::Observable.range(0, 10).count

subscription = source.subscribe(
lambda {|x|
Expand All @@ -18,7 +18,7 @@
# => Completed

# With a predicate
source = RX::Observable.range(0, 10)
source = RxRuby::Observable.range(0, 10)
.count {|x| x % 2 === 0 }

subscription = source.subscribe(
Expand Down
8 changes: 4 additions & 4 deletions examples/create.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'rx'
require 'rx_ruby'

# Using a function
source = RX::Observable.create {|observer|
source = RxRuby::Observable.create {|observer|
observer.on_next(42)
observer.on_completed

Expand Down Expand Up @@ -30,12 +30,12 @@
# => disposed

# Using a disposable
source = RX::Observable.create {|observer|
source = RxRuby::Observable.create {|observer|
observer.on_next(42)
observer.on_completed

# Note that this is optional, you do not have to return this if you require no cleanup
RX::Disposable.create {
RxRuby::Disposable.create {
puts 'disposed'
}
}
Expand Down
6 changes: 3 additions & 3 deletions examples/debounce.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'rx'
require 'rx_ruby'

times = [
{ value: 0, time: 0.1 },
Expand All @@ -9,9 +9,9 @@
]

# Delay each item by time and project value
source = RX::Observable.from(times)
source = RxRuby::Observable.from(times)
.flat_map {|item|
RX::Observable.of(item[:value])
RxRuby::Observable.of(item[:value])
.delay(item[:time])
}
.debounce 0.5 # ms
Expand Down
Loading

0 comments on commit 8befc0b

Please sign in to comment.