Module: Boundy::Domain::InstanceMethods

Defined in:
lib/boundy/domain.rb

Instance Method Summary collapse

Instance Method Details

#comparatorObject



99
100
101
# File 'lib/boundy/domain.rb', line 99

def comparator
  Boundy::Domain::Comparator
end

#constrain_to(subject) ⇒ Object



85
86
87
# File 'lib/boundy/domain.rb', line 85

def constrain_to(subject)
  constrainer(subject).constrain
end

#constrainer(subject) ⇒ Object



89
90
91
92
93
94
95
96
97
# File 'lib/boundy/domain.rb', line 89

def constrainer(subject)
  if subject.class == ::Range
    Boundy::Range::Constrainer.new(self, subject)
  elsif subject.class < Boundy::Domain::Plugin
    Boundy::Domain::Constrainer.new(self, subject)
  else
    raise "I can't constrain myself against a #{subject.class}"
  end
end

#format(formatter) ⇒ Object



103
104
105
106
107
# File 'lib/boundy/domain.rb', line 103

def format(formatter)
  if from.finite?
  elsif to.finite?
  end
end

#joinable?(subject) ⇒ Boolean

Returns:

  • (Boolean)


81
82
83
# File 'lib/boundy/domain.rb', line 81

def joinable?(subject)
  strictly_earlier?(subject) || strictly_later?(subject)
end

#within?(subject) ⇒ Boolean

Returns:

  • (Boolean)


76
77
78
79
# File 'lib/boundy/domain.rb', line 76

def within?(subject)
  @from.within?(subject) || @from.after?(subject) and
  @to.within?(subject) || @to.before?(subject)
end