Sha256: 769954a7a2623ce3127572b27b779bca0e1e2b25649eab6a0b0d2ca259ec7a67

Contents?: true

Size: 377 Bytes

Versions: 1

Compression:

Stored size: 377 Bytes

Contents

module Julia
  class Action
    attr_reader :key, :action, :block

    def initialize(key, action, &block)
      @key    = key
      @action = action
      @block  = block
    end

    def get_value(record)
      return block.call(record) if block
      return record.instance_exec(&action) if action.is_a? Proc

      record.send [action, key].compact.first
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
julia_builder-0.1.3 lib/julia/action.rb