Sha256: a6ed11c00cacfa32aa2fe7dcf8e8db797af4617248e88c1075eec64b9f135d07

Contents?: true

Size: 603 Bytes

Versions: 3

Compression:

Stored size: 603 Bytes

Contents

module ROM
  module SQL
    class Relation < ROM::Relation
      # View DSL evaluator
      #
      # @api private
      class ViewDSL
        attr_reader :name

        attr_reader :attributes

        attr_reader :relation_block

        def initialize(name, &block)
          @name = name
          instance_eval(&block)
        end

        def header(attributes)
          @attributes = attributes
        end

        def relation(&block)
          @relation_block = lambda(&block)
        end

        def call
          [name, attributes, relation_block]
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rom-repository-0.1.0 lib/rom/repository/ext/relation/view_dsl.rb
rom-repository-0.0.2 lib/rom/repository/ext/relation/view_dsl.rb
rom-repository-0.0.1 lib/rom/repository/ext/relation/view_dsl.rb