cirandas.net

ref: master

app/services/noosfero/fields_decorator.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
class Noosfero::FieldsDecorator
  attr_accessor :object, :context

  def initialize(object, context = nil)
    @object = object
    @context = context
  end

  def method_missing(m, *args)
    object.send(m, *args)
  end

  def fields(field_names = {})
    field_names.inject({}) { |result, field| result.merge!(field => self.send(field))}
  end
end