Module: ActiveList::Helpers
- Included in:
- Definition::ActionColumn, Renderers::SimpleRenderer
- Defined in:
- lib/active_list/helpers.rb
Instance Method Summary collapse
- #recordify(value, record_name) ⇒ Object
- #recordify!(value, record_name) ⇒ Object
- #urlify(value, record_name) ⇒ Object
Instance Method Details
#recordify(value, record_name) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/active_list/helpers.rb', line 14 def recordify(value, record_name) if value.is_a?(Symbol) return record_name + "." + value.to_s elsif value.is_a?(Code) return "(" + value.gsub(/RECORD/, record_name) + ")" else return value.inspect end end |
#recordify!(value, record_name) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/active_list/helpers.rb', line 4 def recordify!(value, record_name) if value.is_a?(Symbol) return record_name + "." + value.to_s elsif value.is_a?(Code) return "(" + value.gsub(/RECORD/, record_name) + ")" else raise ArgumentError, "Code or Symbol must be given to be recordified)" end end |
#urlify(value, record_name) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/active_list/helpers.rb', line 24 def urlify(value, record_name) if value.is_a?(Code) return "(" + value.gsub(/RECORD/, record_name) + ")" else return value.inspect end end |