Sha256: 03f65e6f8c0051fa88d3196daf1b3984febbd256094d99d4d4607b654c069904

Contents?: true

Size: 792 Bytes

Versions: 1

Compression:

Stored size: 792 Bytes

Contents

require 'yaml'
require 'gistdoit/github/user_config'

module GistDoIt
  class Gist
    def initialize(name: nil, content: nil, summary: nil, user_config: Github::UserConfig.new)
      @name = name
      @content = content
      @summary = summary
      @config = user_config
    end

    def github_username
      @config.username
    end

    def content=(file_contents)
      @content = file_contents
    end

    def content
      @content
    end

    def summary
      @summary
    end

    def summary=(text)
      @summary = text
    end

    def name
      @name
    end

    def name=(text)
      @name = text
    end
    
    def to_json
      { "description" => "#{summary}", "public" => false, "files" => { "#{name}" => { "content" => "#{content}" } } }.to_json
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gistdoit-0.0.1 lib/gistdoit/gist.rb