Module: Mobius::Client::Blockchain::KeyPairFactory
- Defined in:
- lib/mobius/client/blockchain/key_pair_factory.rb
Overview
Transforms given value into Stellar::Keypair object.
Class Method Summary collapse
-
.produce(subject) ⇒ Stellar::Keypair
rubocop:disable Metrics/MethodLength, Metrics/CyclomaticComplexity Generates Stellar::Keypair from subject, use Stellar::Client.to_keypair as shortcut.
Class Method Details
.produce(subject) ⇒ Stellar::Keypair
rubocop:disable Metrics/MethodLength, Metrics/CyclomaticComplexity Generates Stellar::Keypair from subject, use Stellar::Client.to_keypair as shortcut.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/mobius/client/blockchain/key_pair_factory.rb', line 8 def produce(subject) case subject when String from_string(subject) when Stellar::Account subject.keypair when Stellar::PublicKey from_public_key(subject) when Stellar::SignerKey from_secret_key(subject) when Stellar::KeyPair subject else raise Mobius::Client::Error::UnknownKeyPairType, "Unknown KeyPair type: #{subject.class.name}" end rescue ArgumentError => e raise Mobius::Client::Error::UnknownKeyPairType, "Unknown KeyPair type: #{e.}" end |