class Rabbit::AuthorConfiguration
Attributes
Public Class Methods
Public Instance Methods
Source
# File lib/rabbit/author-configuration.rb, line 52 def clear @markup_language = nil @name = nil @email = nil @rubygems_user = nil @slideshare_user = nil @speaker_deck_user = nil end
Source
# File lib/rabbit/author-configuration.rb, line 32 def load return unless File.exist?(path) conf = YAMLLoader.load(File.read(path)) clear merge!(conf) rescue format = _("Failed to read author configuration: %s: %s") Rabbit.logger.error(format % [path, $!.message]) end
Source
# File lib/rabbit/author-configuration.rb, line 61 def merge!(conf) @markup_language = conf["markup_language"] || @markup_language @name = conf["name"] || @name @email = conf["email"] || @email @rubygems_user = conf["rubygems_user"] || @rubygems_user @slideshare_user = conf["slideshare_user"] || @slideshare_user @speaker_deck_user = conf["speaker_deck_user"] || @spearker_deck_user end
Source
# File lib/rabbit/author-configuration.rb, line 42 def save create_directory(File.dirname(path)) create_file(path) do |conf_file| conf_file.print(to_yaml) end rescue format = _("Failed to write author configuration: %s: %s") Rabbit.logger.error(format % [path, $!.message]) end
Source
# File lib/rabbit/author-configuration.rb, line 70 def to_hash { "markup_language" => @markup_language, "name" => @name, "email" => @email, "rubygems_user" => @rubygems_user, "slideshare_user" => @slideshare_user, "speaker_deck_user" => @speaker_deck_user, } end
Source
# File lib/rabbit/author-configuration.rb, line 81 def to_yaml to_hash.to_yaml end
Private Instance Methods
Source
# File lib/rabbit/author-configuration.rb, line 86 def path File.expand_path("~/.rabbit/author.yaml") end