Class: Runo::Set::Static

Inherits:
Field
  • Object
show all
Includes:
Runo::Set
Defined in:
lib/_widget/action_update.rb,
lib/set/static.rb

Overview

Author

Akira FUNAI

Copyright

Copyright © 2009-2010 Akira FUNAI

Direct Known Subclasses

Folder

Defined Under Namespace

Classes: Folder

Constant Summary

Constants inherited from Field

Field::DEFAULT_META

Instance Attribute Summary

Attributes inherited from Field

#action, #result

Instance Method Summary collapse

Methods included from Runo::Set

#collect, #each, #errors, #inspect_items, #item, #meta_base_path, #meta_dir, #meta_path, #pending?, #val

Methods inherited from Field

#[], #[]=, #create, #default_action, #delete, #empty?, #errors, #find_ancestor, #get, h, #inspect, instance, #item, #load, #load_default, #meta_admins, #meta_client, #meta_folder, #meta_full_name, #meta_group, #meta_name, #meta_owner, #meta_owners, #meta_roles, #meta_sd, #meta_short_name, #pending?, #permit?, #post, #update, #val, #valid?

Methods included from I18n

_, bindtextdomain, domain, domain=, find_msg, lang, lang=, merge_msg!, msg, n_, parse_msg, po_dir, po_dir=

Constructor Details

#initialize(meta = {}) ⇒ Static

Returns a new instance of Static.



12
13
14
15
16
17
# File 'lib/set/static.rb', line 12

def initialize(meta = {})
  @meta = meta
  @meta.merge!(Runo::Parser.parse_html meta[:html]) if meta[:html]
  @meta[:item] ||= {}
  @item_object = {}
end

Instance Method Details

#commit(type = :temp) ⇒ Object



23
24
25
26
27
28
29
30
31
# File 'lib/set/static.rb', line 23

def commit(type = :temp)
  items = pending_items
  items.each {|id, item| item.commit type }
  if valid?
    @result = (@action == :update) ? items : @action
    @action = nil if type == :persistent
    self
  end
end

#meta_hrefObject



19
20
21
# File 'lib/set/static.rb', line 19

def meta_href
  my[:sd] ? "#{my[:sd][:href]}id=#{my[:id]}/" : "#{Runo.uri}#{my[:dir]}/"
end