Class: Stupidedi::Schema::RepeatCount::Bounded

Inherits:
Stupidedi::Schema::RepeatCount show all
Includes:
Comparable
Defined in:
lib/stupidedi/schema/repeat_count.rb

Constant Summary

Constants inherited from Stupidedi::Schema::RepeatCount

Once, Unbounded

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Stupidedi::Schema::RepeatCount

bounded, unbounded

Constructor Details

#initialize(max) ⇒ Bounded

Returns a new instance of Bounded.



17
18
19
# File 'lib/stupidedi/schema/repeat_count.rb', line 17

def initialize(max)
  @max = max
end

Instance Attribute Details

#maxInteger (readonly)

Returns:

  • (Integer)


15
16
17
# File 'lib/stupidedi/schema/repeat_count.rb', line 15

def max
  @max
end

Instance Method Details

#exclude?(n) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/stupidedi/schema/repeat_count.rb', line 25

def exclude?(n)
  n > @max
end

#include?(n) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/stupidedi/schema/repeat_count.rb', line 21

def include?(n)
  n <= @max
end

#inspectObject



29
30
31
# File 'lib/stupidedi/schema/repeat_count.rb', line 29

def inspect
  @max.to_s
end