Module: Bmg::Ordering

Included in:
Attributes, Native
Defined in:
lib/bmg/support/ordering.rb

Defined Under Namespace

Classes: Attributes, Native

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.new(arg) ⇒ Object

Factory over subclasses



5
6
7
8
9
10
11
12
13
14
# File 'lib/bmg/support/ordering.rb', line 5

def self.new(arg)
  case arg
  when Ordering
    arg
  when Proc
    Native.new(arg)
  else
    Attributes.new(arg)
  end
end

Instance Method Details

#call(t1, t2) ⇒ Object



16
17
18
# File 'lib/bmg/support/ordering.rb', line 16

def call(t1, t2)
  comparator.call(t1, t2)
end

#map(*args, &bl) ⇒ Object



24
25
26
# File 'lib/bmg/support/ordering.rb', line 24

def map(*args, &bl)
  to_pairs.map(*args, &bl)
end

#to_aObject



20
21
22
# File 'lib/bmg/support/ordering.rb', line 20

def to_a
  to_pairs
end