Class: Milkode::WebSetting
- Inherits:
-
Object
- Object
- Milkode::WebSetting
- Defined in:
- lib/milkode/cdweb/lib/web_setting.rb
Constant Summary collapse
- DEFAULT_SETTING =
{ :home_title => "Milkode", :home_icon => "/images/MilkodeIcon135.png", :home_font_size => "100%", :header_title => "Milkode", :header_icon => "/images/MilkodeIcon135.png", :favicon => "/images/favicon.ico", :display_about_milkode => true, :hide_update_button => false, }
Class Method Summary collapse
Instance Method Summary collapse
- #about_milkode(locale) ⇒ Object
-
#initialize ⇒ WebSetting
constructor
A new instance of WebSetting.
Constructor Details
#initialize ⇒ WebSetting
Returns a new instance of WebSetting.
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/milkode/cdweb/lib/web_setting.rb', line 38 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 |
Class Method Details
.hash_method(name) ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/milkode/cdweb/lib/web_setting.rb', line 28 def self.hash_method(name) define_method(name) do if @data[name] @data[name] else DEFAULT_SETTING[name] end end end |
Instance Method Details
#about_milkode(locale) ⇒ Object
58 59 60 61 62 63 64 |
# File 'lib/milkode/cdweb/lib/web_setting.rb', line 58 def about_milkode(locale) if (@data[:display_about_milkode]) '<a href="http://milkode.ongaeshi.me">'+I18n.t(:about_milkode, locale: locale)+'</a>' else '' end end |