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 15 |
# File 'lib/solana_rpc_ruby/helper_methods.rb', line 9 def blank?(object) unless [String, Array, Hash, Integer, NilClass].include? object.class raise ArgumentError, 'Object must be a String, Array or Hash or Integer or nil class.' end object.nil? || object.try(:empty?) end |
#create_method_name(method) ⇒ String
Creates method name to match names required by Solana RPC JSON.
22 23 24 25 26 27 28 |
# File 'lib/solana_rpc_ruby/helper_methods.rb', line 22 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 |