Sha256: d7312477174d1e36b67d1e9df7433066a9d40a53971ee5df6a25f68c82b47f9c

Contents?: true

Size: 753 Bytes

Versions: 1

Compression:

Stored size: 753 Bytes

Contents

require 'ostruct'

# Class: Subtype (Aura)
# A subtype.
#
# ## Description
#    This is an OpenStruct. See {AuraSubtyped} for details.
#
# ## Allowed options
#
#  * `name`
#  * `template`
#  * `parentable`
#  * `deletable`
#  * `allowed_subtypes` - Array of symbols of subtypes permitted for its children
#
class Aura
class Subtype < OpenStruct
  def parentable
    r = @table[:parentable]; r.nil? ? true : r
  end

  alias parentable? parentable

  def deletable
    r = @table[:deletable]; r.nil? ? true : r
  end

  alias deletable? deletable

  def to_s
    name
  end

  def name
    @table[:name].to_s
  end

  def template
    @table[:template] || 'show'
  end

  def _id
    # Alias for #id for 1.8.6 compatibility
    @table[:id]
  end
end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
aura-0.0.1.pre10 lib/aura/subtype.rb