Sha256: b27b4bd4c946d789f691a9ad1fe9929254c0a57cb7c2c1d10511c480cc0f13d1
Contents?: true
Size: 1.13 KB
Versions: 1
Compression:
Stored size: 1.13 KB
Contents
module CaRuby class Database # Database CRUD operation. class Operation attr_reader :type, :subject, :attribute # @param [:find, :query, :create, :update, :delete] type the database operation type # @param [Persistable] subject the domain object on which the operation is performed # @param [{Symbol => Object}, Symbol, nil] the operation characteristics # @option opts [Symbol] :attribute the query attribute # @option opts [Boolean] :autogenerated whether this is an auto-generated subject update def initialize(type, subject, opts=nil) @type = type @subject = subject @attribute = Options.get(:attribute, opts) @autogenerated = Options.get(:autogenerated, opts, false) end # @return [Boolean] whether this is a create or update def save? @type == :create or @type == :update end # @return [Boolean] whether this operation is an update of an auto-generated subject def autogenerated? @autogenerated end def to_s "#{@subject.qp} #{attribute} #{type}" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
caruby-core-2.1.1 | lib/caruby/database/operation.rb |