Class: Runo::Set::Static::Folder
- Inherits:
-
Runo::Set::Static
- Object
- Field
- Runo::Set::Static
- Runo::Set::Static::Folder
- Defined in:
- lib/_widget/crumb.rb,
lib/set/static_folder.rb,
lib/_widget/action_login.rb,
lib/_widget/action_signup.rb,
lib/_widget/me.rb
Overview
- Author
-
Akira FUNAI
- Copyright
-
Copyright © 2009-2010 Akira FUNAI
Constant Summary
Constants inherited from Field
Instance Attribute Summary
Attributes inherited from Field
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(meta = {}) ⇒ Folder
constructor
A new instance of Folder.
- #meta_dir ⇒ Object
- #meta_html_dir ⇒ Object
Methods inherited from Runo::Set::Static
Methods included from Runo::Set
#collect, #each, #errors, #inspect_items, #item, #meta_base_path, #meta_path, #pending?, #val
Methods inherited from Field
#[], #[]=, #commit, #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 = {}) ⇒ Folder
Returns a new instance of Folder.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/set/static_folder.rb', line 12 def initialize( = {}) [:dir] = [:parent] ? ::File.join([:parent][:dir], [:id]) : [:id] [:html] = load_html([:dir], [:parent]) super ::Dir.glob(::File.join Runo['skin_dir'], my[:html_dir].to_s, '*.html').each {|f| action = ::File.basename(f, '.*').intern merge_tmpl(@meta, Runo::Parser.parse_html(::File.read(f), action)) if action != :index } ::Dir.glob(::File.join Runo['skin_dir'], my[:html_dir].to_s, '*.xml').each {|f| action = ::File.basename(f, '.*').intern merge_tmpl(@meta, Runo::Parser.parse_xml(::File.read(f), action)) if action != :index } @meta[:tmpl].values.each {|tmpl| tmpl.sub!(/<head>([\s\n]*)/i) { "#{$&}<base href=\"@(href)\" />#{$1}" } } if @meta[:tmpl] @meta.merge! load_yaml(my[:dir], my[:parent]) end |
Class Method Details
.root ⇒ Object
8 9 10 |
# File 'lib/set/static_folder.rb', line 8 def self.root self.new(:id => '') end |
Instance Method Details
#meta_dir ⇒ Object
35 36 37 |
# File 'lib/set/static_folder.rb', line 35 def @meta[:dir] end |
#meta_html_dir ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/set/static_folder.rb', line 39 def if ::File.readable? ::File.join(Runo['skin_dir'], my[:dir], 'index.html') my[:dir] elsif my[:parent] my[:parent][:html_dir] end end |