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

Inherits:
Stupidedi::Schema::RepeatCount show all
Extended by:
Forwardable
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.



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

def initialize(max)
  @max = max
end

Instance Attribute Details

#maxInteger (readonly)

Returns:



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

def max
  @max
end

Instance Method Details

#exclude?(n) ⇒ Boolean

Returns:

  • (Boolean)


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

def exclude?(n)
  n > @max
end

#include?(n) ⇒ Boolean

Returns:

  • (Boolean)


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

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

#inspectObject



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

def inspect
  @max.to_s
end