Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: opal/opal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: ba569698058c
Choose a base ref
...
head repository: opal/opal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: cef2632f2aff
Choose a head ref
  • 3 commits
  • 2 files changed
  • 2 contributors

Commits on May 14, 2015

  1. Enable these specs

    wied03 committed May 14, 2015
    Copy the full SHA
    5a61f78 View commit details
  2. Added implementation of the |, +, and union methods/aliases based on …

    …Ruby stdlib implementation
    wied03 committed May 14, 2015
    Copy the full SHA
    80bd49e View commit details
  3. Merge pull request #856 from wied03/features/set_add

    Stdlib/Set methods, add the +,| operations and union method
    meh committed May 14, 2015
    Copy the full SHA
    cef2632 View commit details
Showing with 12 additions and 2 deletions.
  1. +2 −2 spec/rubyspecs
  2. +10 −0 stdlib/set.rb
4 changes: 2 additions & 2 deletions spec/rubyspecs
Original file line number Diff line number Diff line change
@@ -232,6 +232,8 @@ stdlib/rubysl-set/spec/replace_spec
stdlib/rubysl-set/spec/size_spec
stdlib/rubysl-set/spec/subtract_spec
stdlib/rubysl-set/spec/to_a_spec
stdlib/rubysl-set/spec/plus_spec
stdlib/rubysl-set/spec/union_spec
# stdlib/rubysl-set/spec/divide_spec
# stdlib/rubysl-set/spec/exclusion_spec
# stdlib/rubysl-set/spec/flatten_merge_spec
@@ -241,7 +243,6 @@ stdlib/rubysl-set/spec/to_a_spec
# stdlib/rubysl-set/spec/inspect_spec
# stdlib/rubysl-set/spec/intersection_spec
# stdlib/rubysl-set/spec/keep_if_spec
# stdlib/rubysl-set/spec/plus_spec
# stdlib/rubysl-set/spec/pretty_print_cycle_spec
# stdlib/rubysl-set/spec/pretty_print_spec
# stdlib/rubysl-set/spec/proper_subset_spec
@@ -250,7 +251,6 @@ stdlib/rubysl-set/spec/to_a_spec
# stdlib/rubysl-set/spec/select_spec
# stdlib/rubysl-set/spec/subset_spec
# stdlib/rubysl-set/spec/superset_spec
# stdlib/rubysl-set/spec/union_spec

stdlib/rubysl-date/spec/date/add_month_spec
stdlib/rubysl-date/spec/date/add_spec
10 changes: 10 additions & 0 deletions stdlib/set.rb
Original file line number Diff line number Diff line change
@@ -147,6 +147,16 @@ def subtract(enum)
enum.each { |item| delete item }
self
end

def |(enum)
unless enum.respond_to? :each
raise ArgumentError, "value must be enumerable"
end
dup.merge(enum)
end

alias + |
alias union |

def to_a
@hash.keys