lib/stellar/dsl.rb in stellar-base-0.29.0 vs lib/stellar/dsl.rb in stellar-base-0.30.0
- old
+ new
@@ -51,9 +51,12 @@
# @raise [TypeError] if subject cannot be converted to Stellar::Asset
def Asset(subject = nil)
case subject
when Asset
subject
+ when Array
+ raise TypeError, "Invalid asset type #{subject[0]}" unless [:native, :alphanum4, :alphanum12].include?(subject[0])
+ Asset.send(*subject)
when nil, /^(XLM[-:])?native$/
Asset.native
when /^([0-9A-Z]{1,4})[-:](G[A-Z0-9]{55})$/
Asset.alphanum4($1, KeyPair($2))
when /^([0-9A-Z]{5,12})[-:](G[A-Z0-9]{55})$/