mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
remove openstruct dependency from all of pry.
This commit is contained in:
parent
d544db3690
commit
91d412c044
6 changed files with 8 additions and 8 deletions
|
@ -102,7 +102,7 @@ class Pry
|
|||
else
|
||||
# Otherwise, saves current binding stack as old stack and pops last
|
||||
# binding out of binding stack (the old stack still has that binding).
|
||||
_pry_.command_state["cd"] ||= OpenStruct.new # FIXME
|
||||
_pry_.command_state["cd"] ||= Pry::Config.from_hash({}) # FIXME
|
||||
_pry_.command_state['cd'].old_stack = _pry_.binding_stack.dup
|
||||
_pry_.binding_stack.pop
|
||||
end
|
||||
|
|
|
@ -284,7 +284,7 @@ class Pry
|
|||
# state.my_state = "my state" # this will not conflict with any
|
||||
# # `state.my_state` used in another command.
|
||||
def state
|
||||
_pry_.command_state[match] ||= OpenStruct.new
|
||||
_pry_.command_state[match] ||= Pry::Config.from_hash({})
|
||||
end
|
||||
|
||||
# Revaluate the string (str) and perform interpolation.
|
||||
|
|
|
@ -43,7 +43,7 @@ class Pry
|
|||
# Does not reload plugin if it's already active.
|
||||
def activate!
|
||||
# Create the configuration object for the plugin.
|
||||
Pry.config.send("#{gem_name.gsub('-', '_')}=", OpenStruct.new)
|
||||
Pry.config.send("#{gem_name.gsub('-', '_')}=", Pry::Config.from_hash({}))
|
||||
|
||||
begin
|
||||
require gem_name if !active?
|
||||
|
|
|
@ -522,7 +522,7 @@ class Pry
|
|||
open_token = @indent.open_delimiters.any? ? @indent.open_delimiters.last :
|
||||
@indent.stack.last
|
||||
|
||||
c = OpenStruct.new(
|
||||
c = Pry::Config.from_hash({
|
||||
:object => object,
|
||||
:nesting_level => binding_stack.size - 1,
|
||||
:open_token => open_token,
|
||||
|
@ -533,7 +533,7 @@ class Pry
|
|||
:binding_stack => binding_stack,
|
||||
:input_array => input_array,
|
||||
:eval_string => @eval_string,
|
||||
:cont => !@eval_string.empty?)
|
||||
:cont => !@eval_string.empty?})
|
||||
|
||||
Pry.critical_section do
|
||||
# If input buffer is empty then use normal prompt
|
||||
|
|
|
@ -9,7 +9,7 @@ unless Object.const_defined? 'Pry'
|
|||
end
|
||||
|
||||
require 'mocha/api'
|
||||
|
||||
require "ostruct"
|
||||
require 'pry/test/helper'
|
||||
require 'spec_helpers/bacon'
|
||||
require 'spec_helpers/mock_pry'
|
||||
|
|
|
@ -7,7 +7,7 @@ describe "Prompts" do
|
|||
redirect_pry_io(InputTester.new("exit-all")) do
|
||||
Pry.start(self, :prompt => proc { |v| config = v })
|
||||
end
|
||||
config.is_a?(OpenStruct).should == true
|
||||
config.is_a?(Pry::Config).should == true
|
||||
end
|
||||
|
||||
it 'should get full config object, when using a proc array' do
|
||||
|
@ -15,7 +15,7 @@ describe "Prompts" do
|
|||
redirect_pry_io(InputTester.new("exit-all")) do
|
||||
Pry.start(self, :prompt => [proc { |v| config1 = v }, proc { |v| config2 = v }])
|
||||
end
|
||||
config1.is_a?(OpenStruct).should == true
|
||||
config1.is_a?(Pry::Config).should == true
|
||||
end
|
||||
|
||||
it 'should receive correct data in the config object' do
|
||||
|
|
Loading…
Reference in a new issue