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

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

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.



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

def initialize(max)
  @max = max
end

Instance Attribute Details

#maxInteger (readonly)

Returns:

  • (Integer)


13
14
15
# File 'lib/stupidedi/schema/repeat_count.rb', line 13

def max
  @max
end

Instance Method Details

#exclude?(n) ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/stupidedi/schema/repeat_count.rb', line 23

def exclude?(n)
  n > @max
end

#include?(n) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/stupidedi/schema/repeat_count.rb', line 19

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

#inspect



27
28
29
# File 'lib/stupidedi/schema/repeat_count.rb', line 27

def inspect
  @max.to_s
end