krtschmr / monero

Ruby client to connect to the Monero RPC
MIT License
24 stars 12 forks source link

Fix error with no constantize method #6

Closed rearden-steel closed 6 years ago

rearden-steel commented 6 years ago

Fixes this error:

2.4.1 :091 > RPC::Wallet.get_all_incoming_transfers
NoMethodError: undefined method `constantize' for "RPC::IncomingTransfer":String
langesi commented 6 years ago

Sorry, I just realised the version is the same. Could you maybe change the version to "0.0.0.7" of the gem at monero/lib/rpc/version.rb?

rearden-steel commented 6 years ago

Done, sorry.

krtschmr commented 6 years ago

I'm not sure if it's cool to make active_support a neccessary dependency. for sure, i use this as a gem for rails application, but shouldn't it be more pure ruby?

stackoverflow gave me a workaround for constantize which might look something like this (untested)

Object.const_set( (RPC.config.transfer_clazz || "RPC::IncomingTransfer").classify, Class.new)

won't that be better, rather then using the whole active_support? we might even steal just the String.constantize method and override String only.

langesi commented 6 years ago

I'm sorry. I just tested it, I did not look for an alternative. I can have a look at it tomorrow if you'd like to.