Sha256: e140eebc9d2411efb9e73b6dfa7b3ceb68d374fc865b009c835f6739ccd34773

Contents?: true

Size: 495 Bytes

Versions: 3

Compression:

Stored size: 495 Bytes

Contents

# frozen_string_literal: true

class Tramway::ExtendedApplicationForm < Tramway::ApplicationForm
  class << self
    def properties(*args)
      @@extendable_properties ||= []
      @@extendable_properties += args
      super(*args)
    end
  end

  def initialize(model)
    @@extendable_properties.each do |prop|
      next if model.respond_to? prop

      model.class.define_method prop do
      end
      model.class.define_method "#{prop}=" do |value|
      end
    end
    super
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tramway-0.1.2 app/forms/tramway/extended_application_form.rb
tramway-0.1.1.1 app/forms/tramway/extended_application_form.rb
tramway-0.1.1 app/forms/tramway/extended_application_form.rb