Sha256: a831c949ec28f0f6ff76e9def404d35e82fe7cefffa86a0281a8f2b2f07af4a3
Contents?: true
Size: 1.04 KB
Versions: 17
Compression:
Stored size: 1.04 KB
Contents
# -*- coding: utf-8 -*- # # @file # @brief # @author ongaeshi # @date 2012/03/24 require 'milkode/cdweb/lib/database' require 'yaml' module Milkode class WebSetting DEFAULT_SETTING = { :home_title => "Milkode", :home_icon => "/images/MilkodeIcon135.png", :header_title => "Milkode", :header_icon => "/images/MilkodeIcon135.png", :display_about_milkode => true } def self.hash_method(name) define_method(name) do @data[name] end end def initialize fname = File.join(Database.dbdir, "milkweb.yaml") if FileTest.exist? fname open(fname) do |f| @data = YAML.load(f.read) end else @data = DEFAULT_SETTING end end hash_method :home_title hash_method :home_icon hash_method :header_title hash_method :header_icon def about_milkode if (@data[:display_about_milkode]) ', <a href="http://milkode.ongaeshi.me">milkodeについて</a>' else '' end end end end
Version data entries
17 entries across 17 versions & 1 rubygems