Method: Atlas::Box.create

Defined in:
lib/atlas/box.rb

.create(attr = {}) ⇒ Box

Create a new Box.

Parameters:

  • attr (Hash) (defaults to: {})

    attributes to create the box with

  • attr (String) (defaults to: {})

    :name The name of the box, used to identify it.

Options Hash (attr):

  • :username (String)

    The username to assign the box to.

  • :short_description (String)

    The short description is used on small box previews.

  • :description (String)

    Markdown text used as a full-length and in-depth description of the box.

  • :is_private (Boolean)

    A boolean if the box should be private or not.

Returns:

  • (Box)

    a newly created box.



44
45
46
47
48
49
# File 'lib/atlas/box.rb', line 44

def self.create(attr = {})
  tag = "#{attr.fetch(:username, '')}/#{attr[:name]}"
  box = new(tag, attr)
  box.save
  box
end