class Plugin::Extract::Setting

Public Class Methods

new(hash) click to toggle source
Calls superclass method
# File core/plugin/extract/model/setting.rb, line 24
def initialize(hash)
  hash[:id] ||= Time.now.to_i
  hash[:slug] ||= "extract_#{hash[:id]}"
  hash[:sources] ||= []
  super(hash)
  Plugin.call(:extract_tab_create, self)
end

Public Instance Methods

delete(force: false) click to toggle source

この抽出タブを消去する。 force: に真を渡すと、確認ダイアログを表示せずに削除する。

# File core/plugin/extract/model/setting.rb, line 66
def delete(force: false)
  if force
    Plugin.call(:extract_tab_delete, id)
  else
    Plugin.call(:extract_tab_delete_with_confirm, id)
  end
end
export_to_userconfig() click to toggle source
# File core/plugin/extract/model/setting.rb, line 74
def export_to_userconfig
  { name: name,
    id: id,
    slug: slug,
    sources: sources,
    sound: sound ? sound.to_s : nil,
    popup: popup?,
    icon: icon ? icon.to_s : nil,
    order: order,
    uri: uri.to_s,
    sexp: self[:sexp]
  }
end
find_ordering_obj() click to toggle source
# File core/plugin/extract/model/setting.rb, line 44
def find_ordering_obj
  Enumerator.new{|y|
    Plugin.filtering(:extract_order, y)
  }.find{|o| o.slug == order }
end
notify_update() click to toggle source

更新イベントを発生させる。

# File core/plugin/extract/model/setting.rb, line 60
def notify_update
  Plugin.call(:extract_tab_update, self)
end
order() click to toggle source
# File core/plugin/extract/model/setting.rb, line 40
def order
  (self[:order] || :modified).to_sym
end
path() click to toggle source
# File core/plugin/extract/model/setting.rb, line 88
def path
  "/#{id}"
end
sexp() click to toggle source
# File core/plugin/extract/model/setting.rb, line 50
def sexp
  self[:sexp]
end
slug() click to toggle source
# File core/plugin/extract/model/setting.rb, line 32
def slug
  self[:slug].to_sym
end
sources() click to toggle source
# File core/plugin/extract/model/setting.rb, line 36
def sources
  (self[:sources] || []).map(&:to_sym)
end
using?(source_name) click to toggle source

引数のsourceがsourcesに含まれていれば真を返す

# File core/plugin/extract/model/setting.rb, line 55
def using?(source_name)
  sources.include?(source_name.to_sym)
end