Sha256: 658dc13b21812f5d91837a8e6c8ef0b6243ca184ab8528ea949086d569ddac21

Contents?: true

Size: 743 Bytes

Versions: 7

Compression:

Stored size: 743 Bytes

Contents

# encoding: UTF-8

module Spontaneous::Prototypes
  class StylePrototype
    attr_reader :owner, :name, :options

    def initialize(owner, name, options = {})
      @owner, @name, @options = owner, name, options
    end

    def default?
      options[:default]
    end

    def schema_name
      "style/#{owner.schema_id}/#{name}"
    end

    def schema_owner
      owner
    end

    def owner_sid
      schema_owner.schema_id
    end

    def style(owner)
      Spontaneous::Style.new(owner, self)
    end

    def schema_id
      Spontaneous.schema.schema_id(self)
    end

    def export(user)
      {
        :name => name.to_s,
        :schema_id => schema_id.to_s
      }
    end
  end # StylePrototype
end # Spontaneous::Prototypes

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
spontaneous-0.2.0.alpha7 lib/spontaneous/prototypes/style_prototype.rb
spontaneous-0.2.0.alpha6 lib/spontaneous/prototypes/style_prototype.rb
spontaneous-0.2.0.alpha5 lib/spontaneous/prototypes/style_prototype.rb
spontaneous-0.2.0.alpha4 lib/spontaneous/prototypes/style_prototype.rb
spontaneous-0.2.0.alpha3 lib/spontaneous/prototypes/style_prototype.rb
spontaneous-0.2.0.alpha2 lib/spontaneous/prototypes/style_prototype.rb
spontaneous-0.2.0.alpha1 lib/spontaneous/prototypes/style_prototype.rb