add: config can edit

This commit is contained in:
viletyy 2022-06-21 16:57:18 +08:00
parent b1f56b97e0
commit 74771e80db
2 changed files with 21 additions and 1 deletions

View File

@ -16,6 +16,26 @@ module Gitea
@http = Http.new(@config) @http = Http.new(@config)
end end
def config
@config
end
def config=(config)
unless config.is_a?(Gitea::Api::Config)
fail Exception, "load config failure!"
end
@config = config
@http = Http.new(config)
end
def token
@config.token
end
def token=(token)
@config.token = token
end
include Gitea::Api::Issue include Gitea::Api::Issue
include Gitea::Api::Repository include Gitea::Api::Repository
include Gitea::Api::Settings include Gitea::Api::Settings

View File

@ -5,7 +5,7 @@ module Gitea
module AttrHelper module AttrHelper
def attrs(*s) def attrs(*s)
define_method(:attrs) {s} define_method(:attrs) {s}
attr_reader(*s) attr_accessor(*s)
end end
end end