Sha256: 61f73a69f643399bd4a317b30194fca5341c02c2064fee2cb9159ba1ea2b2069

Contents?: true

Size: 839 Bytes

Versions: 7

Compression:

Stored size: 839 Bytes

Contents

module SolanaRpcRuby
  # Namespace for helper methods.
  module HelperMethods
    # Checks if the object is nil or empty.
    # 
    # @param object [String, Array, Hash]
    # 
    # @return [Boolean]
    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

    # Creates method name to match names required by Solana RPC JSON.
    # 
    # @param method [String]
    # 
    # @return [String]
    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
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
solana_rpc_ruby-1.3.0 lib/solana_rpc_ruby/helper_methods.rb
solana_rpc_ruby-1.2.0 lib/solana_rpc_ruby/helper_methods.rb
solana_rpc_ruby-1.1.4 lib/solana_rpc_ruby/helper_methods.rb
solana_rpc_ruby-1.1.3 lib/solana_rpc_ruby/helper_methods.rb
solana_rpc_ruby-1.1.2 lib/solana_rpc_ruby/helper_methods.rb
solana_rpc_ruby-1.1.1 lib/solana_rpc_ruby/helper_methods.rb
solana_rpc_ruby-1.1.0 lib/solana_rpc_ruby/helper_methods.rb