Sha256: 438539bf120de4b9ac6984af7a61dd57825c0b8eb8f0a816ef792e8c8992bc00

Contents?: true

Size: 583 Bytes

Versions: 3

Compression:

Stored size: 583 Bytes

Contents

class Gamefic::Query::Available < Gamefic::Query::Base
  def context_from(subject)
    result = []
    top = subject.room || subject.parent
    unless top.nil?
      result.concat subquery_accessible(top)
    end
    result.delete subject
    subject.children.each { |c|
      result.push c
      result.concat subquery_accessible(c)
    }
    result
  end
end

class Gamefic::Query::Room < Gamefic::Query::Base
  def context_from(subject)
    subject.room ? [subject.room] : []
  end
end

Gamefic.script do
  set_default_query Gamefic::Query::Available
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gamefic-standard-2.2.0 lib/gamefic-standard/queries.rb
gamefic-standard-2.1.0 lib/gamefic-standard/queries.rb
gamefic-standard-2.0.0 lib/gamefic-standard/queries.rb