Sha256: 07192508e7c68558d31487a61253d15e2acb367ff2cbc95063b7282ed68a181d

Contents?: true

Size: 446 Bytes

Versions: 5

Compression:

Stored size: 446 Bytes

Contents

module Pakyow
  module Presenter
    class BindingEval
      include Pakyow::Helpers

      attr_reader :context, :bindable

      def initialize(prop, bindable, context)
        @prop = prop
        @bindable = bindable
        @context = context
      end

      def value
        if bindable.is_a?(Hash)
          bindable[@prop]
        elsif bindable.respond_to?(@prop)
          bindable.send(@prop)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pakyow-presenter-0.10.2 pakyow-presenter/lib/presenter/binding_eval.rb
pakyow-presenter-0.10.1 pakyow-presenter/lib/presenter/binding_eval.rb
pakyow-presenter-0.10.0 pakyow-presenter/lib/presenter/binding_eval.rb
pakyow-presenter-0.9.1 pakyow-presenter/lib/presenter/binding_eval.rb
pakyow-presenter-0.9.0 pakyow-presenter/lib/presenter/binding_eval.rb