mirror of
https://github.com/bumi/openalias-ruby
synced 2024-10-03 10:29:46 +00:00
Add Openalias.lookup as alias to Openalias.addresses
The rust implementation uses #addresses but I find #lookup a bit more intuitive and descriptive.
This commit is contained in:
parent
867cb68df6
commit
cd337c42b1
@ -30,7 +30,7 @@ Or install it yourself as:
|
||||
## Usage
|
||||
|
||||
```ruby
|
||||
Openalias.addresses('btc@michaelbumann.com')
|
||||
Openalias.addresses('btc@michaelbumann.com') # or Openalias.lookup('btc@michaelbumann.com')
|
||||
=> [#<Openalias::CryptoAddress cryptocurrency="btc", address="3MGfEx4iaVEAy8nD4rWdocgrPo8aCR4Zfa", recipient_name="bumi">]
|
||||
|
||||
Openalias.addresses('donate.getmonero.org')
|
||||
|
@ -19,4 +19,7 @@ class Openalias
|
||||
cargo_project_path: toplevel_dir,
|
||||
ruby_project_path: toplevel_dir)
|
||||
|
||||
def self.lookup(address)
|
||||
self.addresses(address)
|
||||
end
|
||||
end
|
||||
|
@ -5,11 +5,15 @@ RSpec.describe Openalias do
|
||||
expect(Openalias::VERSION).not_to be nil
|
||||
end
|
||||
|
||||
it "provides #lookup as an alias for #addresses" do
|
||||
expect(Openalias).to respond_to(:lookup)
|
||||
end
|
||||
|
||||
it "provides ? methods to check for the currency" do
|
||||
expect(Openalias.addresses('donate.getmonero.org').find { |c| c.cryptocurrency.downcase == 'xmr' }.xmr?).to eql(true)
|
||||
expect(Openalias.addresses('donate.getmonero.org').find { |c| c.cryptocurrency.downcase == 'xmr' }.btc?).to eql(false)
|
||||
expect(Openalias.addresses('donate.getmonero.org').find(&:xmr?).xmr?).to eql(true)
|
||||
expect(Openalias.addresses('donate.getmonero.org').find(&:xmr?).xmr).to eql(true)
|
||||
expect(Openalias.addresses('donate.getmonero.org').find(&:xmr?).btc?).to eql(false)
|
||||
end
|
||||
|
||||
it "provides accessors for the data" do
|
||||
|
Loading…
Reference in New Issue
Block a user