Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/kiss/ext/core.rb
Instance Method Summary collapse
- #_instance_variables_set_from_attrs(attrs) ⇒ Object
- #export_instance_variables(object) ⇒ Object
- #html_escape(*args) ⇒ Object
- #import_instance_variables(object) ⇒ Object
- #instance_variables_hash ⇒ Object
- #instance_variables_set(h) ⇒ Object
- #url_escape(*args) ⇒ Object
- #validate(*args) ⇒ Object
Instance Method Details
#_instance_variables_set_from_attrs(attrs) ⇒ Object
106 107 108 |
# File 'lib/kiss/ext/core.rb', line 106 def _instance_variables_set_from_attrs(attrs) attrs.each_pair {|k, v| instance_variable_set(:"@_#{k}", v) } end |
#export_instance_variables(object) ⇒ Object
118 119 120 |
# File 'lib/kiss/ext/core.rb', line 118 def export_instance_variables(object) object.import_instance_variables(self) end |
#html_escape(*args) ⇒ Object
128 129 130 |
# File 'lib/kiss/ext/core.rb', line 128 def html_escape(*args) to_s.html_escape(*args) end |
#import_instance_variables(object) ⇒ Object
110 111 112 113 114 115 116 117 |
# File 'lib/kiss/ext/core.rb', line 110 def import_instance_variables(object) object.instance_variables.each do |v| # skip vars that start with underscore unless v[1, 1] == '_' instance_variable_set(v, object.instance_variable_get(v)) end end end |
#instance_variables_hash ⇒ Object
99 100 101 |
# File 'lib/kiss/ext/core.rb', line 99 def instance_variables_hash new Hash[ instance_variables.map {|k| [k, instance_variable_get(k)] }.flatten ] end |
#instance_variables_set(h) ⇒ Object
102 103 104 |
# File 'lib/kiss/ext/core.rb', line 102 def instance_variables_set(h) h.each_pair {|k, v| instance_variable_set(k, v)} end |
#url_escape(*args) ⇒ Object
125 126 127 |
# File 'lib/kiss/ext/core.rb', line 125 def url_escape(*args) to_s.url_escape(*args) end |
#validate(*args) ⇒ Object
122 123 124 |
# File 'lib/kiss/ext/core.rb', line 122 def validate(*args) to_s.validate(*args) end |