class Pact::ArrayLike

Attributes

contents[R]
min[R]

Public Class Methods

json_create(hash) click to toggle source
# File lib/pact/array_like.rb, line 30
def self.json_create hash
  symbolized_hash = symbolize_keys(hash)
  new(symbolized_hash[:contents], {min: symbolized_hash[:min]})
end
new(contents, options = {}) click to toggle source
# File lib/pact/array_like.rb, line 9
def initialize contents, options = {}
  @contents = contents
  @min = options[:min] || 1
end

Public Instance Methods

==(other) click to toggle source
# File lib/pact/array_like.rb, line 39
def == other
  other.is_a?(ArrayLike) && other.contents == self.contents && other.min == self.min
end
as_json(opts = {}) click to toggle source
# File lib/pact/array_like.rb, line 22
def as_json opts = {}
  to_hash
end
eq(other) click to toggle source
# File lib/pact/array_like.rb, line 35
def eq other
  self == other
end
generate() click to toggle source
# File lib/pact/array_like.rb, line 43
def generate
  min.times.collect{ Pact::Reification.from_term contents }
end
to_hash() click to toggle source
# File lib/pact/array_like.rb, line 14
def to_hash
  {
    :json_class => self.class.name,
    :contents => contents,
    :min => min
  }
end
to_json(opts = {}) click to toggle source
# File lib/pact/array_like.rb, line 26
def to_json opts = {}
  as_json.to_json opts
end