Sha256: d23279941c6895bbac5f2f32bab9e771a7b7ecad4c868a2ea3d55bad2b62be68

Contents?: true

Size: 487 Bytes

Versions: 3

Compression:

Stored size: 487 Bytes

Contents

module ActionWidget
  class Base < SimpleDelegator
    alias view __getobj__
    include SmartProperties

    attr_reader :options

    def initialize(view, attributes = {})
      properties = self.class.properties
      attributes, options = attributes.partition { |name, value| properties.key?(name) }

      @options = Hash[options]
      super(view, Hash[attributes])
    end

    def render
      raise NotImplementedError, "#{self.class} must implement #render"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
action_widget-0.6.1 lib/action_widget/base.rb
action_widget-0.6.0 lib/action_widget/base.rb
action_widget-0.6.0.pre lib/action_widget/base.rb