GithubHelp home page GithubHelp logo

gitflowenumerableruby's Introduction

Ruby Enumerable methods

A comprehensive rebuild on basic Enumerable methods in Ruby for a better understanding in block passing, enumerator and classes and regular expressions as arguments.

This scripts rebuilds ruby Enumerable methods:

  • #each as #my_each
  • #each_with_index as #my_each_with_index
  • #select as #my_select
  • #all? as #my_all?
  • #any? as #my_any?
  • #none? as #my_none?
  • #count as #my_count
  • #map as #my_map
  • #inject as #my_inject

each of them can be used as default Enumerable methods working the exact same way

Rspec testing for all methods, check (./spec/enumerable_spec.rb) .

Rspec test cases:

  1. #my_each with no block passed returns an enumerator
  2. #my_each with block passed do a loop routine
  3. #my_each_with_index with no block passed returns an enumerator
  4. #my_each_with_index with block passed counts index elements
  5. #my_select with no block passed returns an enumerator
  6. #my_each with block passed returns an Array
  7. #my_each with block passed returns an even number array
  8. #my_each with block passed fails an .odd? on array
  9. #my_all? with no block passed returns true
  10. #my_all? with block passed returns true
  11. #my_all? with block passed returns true
  12. #my_all? with block passed returns false
  13. #my_all? with regexp passed returns false
  14. #my_all? with class passed returns true
  15. #my_any? with no block passed returns true
  16. #my_any? with block passed returns true
  17. #my_any? with block passed returns false
  18. #my_any? with block passed returns false
  19. #my_any? with regexp passed returns not true
  20. #my_any? with class passed returns true
  21. #my_none? with no block passed returns false
  22. #my_none? with block passed returns false
  23. #my_none? with block passed returns true
  24. #my_none? with block passed returns not true
  25. #my_none? with regexp passed returns true
  26. #my_none? with class passed returns true
  27. #my_count with no block passed returns number of elements in an array
  28. #my_count with block passed returns number of .even? elements
  29. #my_count with block passed returns number of .odd? elements
  30. #my_count with block passed returns number of x > 5 elements
  31. #my_count with argument passed returns number of element repetition
  32. #my_map with no block passed returns an Enumerator
  33. #my_map with block passed returns a modified array
  34. #my_map with block passed returns a parsed array
  35. #my_inject with block passed returns an array sum
  36. #my_inject with block passed returns a parsed array

Coded by Eduardo 'Usagi' Bonilla: GitHub Testing by Ko Nyan: GitHub

gitflowenumerableruby's People

Contributors

usagib avatar

Stargazers

Sayyod avatar Osong Agberndifor avatar

Watchers

James Cloos avatar  avatar

gitflowenumerableruby's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.