Fix standard ruby style issues
This commit is contained in:
parent
e92a3b1102
commit
986fc47c73
1
Gemfile
1
Gemfile
@ -10,4 +10,3 @@ gem "rake", "~> 13.0"
|
|||||||
gem "rspec", "~> 3.0"
|
gem "rspec", "~> 3.0"
|
||||||
|
|
||||||
gem "standard", "~> 1.3"
|
gem "standard", "~> 1.3"
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ module Rex
|
|||||||
def pop_first_order
|
def pop_first_order
|
||||||
order = @first_order
|
order = @first_order
|
||||||
@first_order = @first_order.next_order
|
@first_order = @first_order.next_order
|
||||||
if @first_order == nil
|
if @first_order.nil?
|
||||||
@last_order = nil
|
@last_order = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -25,11 +25,10 @@ module Rex
|
|||||||
def add_order(order)
|
def add_order(order)
|
||||||
if empty?
|
if empty?
|
||||||
@first_order = order
|
@first_order = order
|
||||||
@last_order = order
|
|
||||||
else
|
else
|
||||||
@last_order.next_order = order
|
@last_order.next_order = order
|
||||||
@last_order = order
|
|
||||||
end
|
end
|
||||||
|
@last_order = order
|
||||||
@order_count += 1
|
@order_count += 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ require "rbtree"
|
|||||||
|
|
||||||
module Rex
|
module Rex
|
||||||
class OrderBook
|
class OrderBook
|
||||||
def initialize()
|
def initialize
|
||||||
@sell_side = tree_with_limit_default
|
@sell_side = tree_with_limit_default
|
||||||
@buy_side = tree_with_limit_default
|
@buy_side = tree_with_limit_default
|
||||||
end
|
end
|
||||||
@ -17,7 +17,6 @@ module Rex
|
|||||||
side[order.price].add_order(order)
|
side[order.price].add_order(order)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def cancel_order(order_id)
|
def cancel_order(order_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -25,7 +24,7 @@ module Rex
|
|||||||
|
|
||||||
def tree_with_limit_default
|
def tree_with_limit_default
|
||||||
tree = RBTree.new
|
tree = RBTree.new
|
||||||
tree.default_proc = -> (tree, key) { tree[key] = Limit.new(key) }
|
tree.default_proc = ->(tree, key) { tree[key] = Limit.new(key) }
|
||||||
tree
|
tree
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user