My solution for "crying angel" problem.
Clone a repository and execute the following sequence of commands:
bundle install
bundle exec rspec
gem build crying_angel.gemspec
gem install cyring_angel-0.0.1.gem
require 'crying_angel'
ol = Location.new(0, 10) # Olenka's location
il = Location.new(301, 10) # Ivanko's location
al = Location.new(0, 0) # Angel's location
p angel_cries?(ol, il, al) # => true
Go to specs to find more examples. Here is how it looks with formatted documentation option:
#angel_cries?
angel can not see Olenka but can see Ivanko
returns false
angel can not see Ivanko but can see Olenka
returns false
angel can not see both
returns false
angel can see both
returns false if distance between Ivanko and Olenka <= 300 km
returns true if distance between Ivanko and Olenka > 300 km
Full docs you can find here.
- Fork it ( https://github.com/veelenga/crying_angel/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request