abstract class Avram::Box
- Avram::Box
- Reference
- Object
Defined in:
avram/box.crConstant Summary
-
SEQUENCES =
{} of String => Int32
Class Method Summary
- .create
- .create(&)
-
.create_pair
Returns an array with 2 instances of the model from the Box.
-
.create_pair(&)
Similar to
.create_pair
, but accepts a block which yields the box instance. - .save
Instance Method Summary
- #create
- #operation
-
#sequence(value : String) : String
Returns a value with a number to use for unique values.
Macro Summary
Instance methods inherited from class Object
blank_for_validates_required? : Bool
blank_for_validates_required?
Class Method Detail
def self.create_pair
#
Returns an array with 2 instances of the model from the Box.
Usage:
tags = TagBox.create_pair
typeof(tags) # => Array(Tag)
tags.size # => 2
def self.create_pair(&)
#
Similar to .create_pair
, but accepts a block which yields the box instance.
Both boxes receive the same argument values.
Usage:
TagBox.create_pair do |box|
# set both boxes name to "test"
box.name("test")
end
Instance Method Detail
Returns a value with a number to use for unique values.
Usage:
class UserBox < Avram::Box
def initialize
username sequence("username") # => username-1, username-2, etc.
email "#{sequence("email")}@example.com" # => [email protected], [email protected], etc.
end
end