Sha256: 71afb8fb172960d6da660e05f0a2e21e463a237783f325b7b00a7a997f825190

Contents?: true

Size: 675 Bytes

Versions: 4

Compression:

Stored size: 675 Bytes

Contents

# frozen_string_literal: true

require 'attr_extras'
require 'json'

# This class create docs from docs.json
class CreateDocs
  pattr_initialize %i[]

  def call
    [ravencoin_methods]
  end

  private

  def docs
    @docs ||= JSON.parse(File.open('docs.json').read)
  end

  def ravencoin_methods
    File.open('ravencoin_methods.md', 'w') do |entry|
      entry << '# Ravencoin remote procedure calls / methods'
      entry << "\r\n#[Home](README.md)"
      with_method do |key|
        entry << "\r\n## #{key} \r\n"
        entry << docs[key]
      end
    end
  end

  def with_method
    docs.each_key do |key|
      next unless key

      yield key
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ravencoin_rpc_ruby-0.3.1 lib/create_docs.rb
ravencoin_rpc_ruby-0.3.0 lib/create_docs.rb
ravencoin_rpc_ruby-0.2.1 lib/create_docs.rb
ravencoin_rpc_ruby-0.2.0 lib/create_docs.rb