Module: SolanaRpcRuby::HelperMethods
- Included in:
- MethodsWrapper, WebsocketsMethodsWrapper
- Defined in:
- lib/solana_rpc_ruby/helper_methods.rb
Overview
Namespace for helper methods.
Instance Method Summary collapse
-
#blank?(object) ⇒ Boolean
Checks if the object is nil or empty.
-
#create_method_name(method) ⇒ String
Creates method name to match names required by Solana RPC JSON.
Instance Method Details
#blank?(object) ⇒ Boolean
Checks if the object is nil or empty.
9 10 11 12 13 14 |
# File 'lib/solana_rpc_ruby/helper_methods.rb', line 9 def blank?(object) raise ArgumentError, 'Object must be a String, Array or Hash or nil class.'\ unless object.is_a?(String) || object.is_a?(Array) || object.is_a?(Hash) || object.nil? object.nil? || object.empty? end |
#create_method_name(method) ⇒ String
Creates method name to match names required by Solana RPC JSON.
21 22 23 24 25 26 27 |
# File 'lib/solana_rpc_ruby/helper_methods.rb', line 21 def create_method_name(method) return '' unless method && (method.is_a?(String) || method.is_a?(Symbol)) method.to_s.split('_').map.with_index do |string, i| i == 0 ? string : string.capitalize end.join end |