lib/magicka/form.rb in magicka-0.5.0 vs lib/magicka/form.rb in magicka-0.5.1
- old
+ new
@@ -1,41 +1,13 @@
# frozen_string_literal: true
module Magicka
# Class responsible for controlling one object form
class Form < Aggregator
- attr_reader :model
-
- def initialize(renderer, model)
- @renderer = renderer
- @model = model
- end
-
with_element(Input)
with_element(Select)
def button(**args)
Button.render(renderer: renderer, **args)
end
-
- def with_model(model)
- new_model = [self.model, model].join('.')
-
- yield Form.new(renderer, new_model)
- end
-
- def equal?(other)
- return unless other.class == self.class
-
- other.renderer == renderer &&
- other.model == model
- end
-
- alias == equal?
-
- protected
-
- attr_reader :renderer
-
- delegate :render, to: :renderer
end
end