Class: Wedge::Plugins::Factory
- Defined in:
- lib/wedge/plugins/factory.rb
Instance Attribute Summary
Attributes inherited from Component
Instance Method Summary collapse
- #[](name, data = {}) ⇒ Object
-
#initialize ⇒ Factory
constructor
A new instance of Factory.
- #stub(data, name, keys = false) ⇒ Object
Methods inherited from Form
#_accessor_options, #_accessors, #_aliases, #_attributes, #_atts_keys, #_keys, #_set_atts, #_with_atts, #_without_atts, attr_accessor, attr_reader, #attributes, #attributes?, #display_errors, form_accessor, inherited, #method_missing, model_alias, #model_attributes, #model_attributes?, #nested?, #options, original_attr_accessor, original_attr_reader, #render_values, #slice, #validate_msg
Methods included from Wedge::Plugins::Form::Delegates
Methods included from Render
#_error_name, #display_errors, #render_values
Methods included from Wedge::Plugins::Form::Validations
#_errors, #_model_errors, #error, #errors, #model_errors, #valid, #valid?, #validate
Methods included from Methods
Methods inherited from Component
config, dom, html, html!, #method_missing, method_missing, plugin, set_dom, store, tmpl, #to_js, #wedge, #wedge_class_store, wedge_config, #wedge_config, #wedge_dom, wedge_dom, #wedge_from_client?, #wedge_from_server?, #wedge_function, wedge_html, #wedge_html, #wedge_javascript, #wedge_method_url, wedge_name, wedge_new, wedge_on, wedge_on_server, #wedge_plugin, #wedge_scope, #wedge_store, #wedge_tmpl, wedge_tmpl, #wedge_trigger
Constructor Details
#initialize ⇒ Factory
Returns a new instance of Factory.
6 7 8 |
# File 'lib/wedge/plugins/factory.rb', line 6 def initialize class_store[:stubs] ||= IndifferentHash.new end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Wedge::Plugins::Form
Instance Method Details
#[](name, data = {}) ⇒ Object
14 15 16 17 18 |
# File 'lib/wedge/plugins/factory.rb', line 14 def [] name, data = {} data = IndifferentHash.new(data) store_data = IndifferentHash.new class_store[:stubs][name].deep_dup HashObject.new store_data.merge data end |
#stub(data, name, keys = false) ⇒ Object
10 11 12 |
# File 'lib/wedge/plugins/factory.rb', line 10 def stub data, name, keys = false class_store[:stubs][name] = parse data, keys end |