Module: RailsConsole

Defined in:
lib/rails-console.rb,
lib/rails-console/user.rb,
lib/rails-console/broker.rb,
lib/rails-console/config.rb,
lib/rails-console/engine.rb,
lib/rails-console/logging.rb,
lib/rails-console/version.rb,
lib/rails-console/pty_session.rb,
app/models/rails_console/session.rb,
app/models/rails_console/log_line.rb,
app/channels/rails_console/console_channel.rb,
app/models/rails_console/application_record.rb,
lib/generators/rails_console/install_generator.rb,
app/controllers/rails_console/consoles_controller.rb

Defined Under Namespace

Modules: Logging Classes: ApplicationRecord, Broker, ConsoleChannel, ConsolesController, Engine, InstallGenerator, LogLine, PtySession, Session

Constant Summary collapse

VERSION =
'0.1.0'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.auditObject

Returns the value of attribute audit.



7
8
9
# File 'lib/rails-console/config.rb', line 7

def audit
  @audit
end

.authorizeObject

Returns the value of attribute authorize.



7
8
9
# File 'lib/rails-console/config.rb', line 7

def authorize
  @authorize
end

.commandObject

Returns the value of attribute command.



7
8
9
# File 'lib/rails-console/config.rb', line 7

def command
  @command
end

.current_userObject

Returns the value of attribute current_user.



7
8
9
# File 'lib/rails-console/config.rb', line 7

def current_user
  @current_user
end

.idle_timeoutObject

Returns the value of attribute idle_timeout.



7
8
9
# File 'lib/rails-console/config.rb', line 7

def idle_timeout
  @idle_timeout
end

.sandbox_commandObject

Returns the value of attribute sandbox_command.



7
8
9
# File 'lib/rails-console/config.rb', line 7

def sandbox_command
  @sandbox_command
end

.socket_pathObject



29
30
31
# File 'lib/rails-console/config.rb', line 29

def socket_path
  @socket_path || default_socket_path
end

.user_classObject

Returns the value of attribute user_class.



7
8
9
# File 'lib/rails-console/config.rb', line 7

def user_class
  @user_class
end

Class Method Details

.authorized?(context) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/rails-console/user.rb', line 4

def self.authorized?(context)
  config.authorize.call(user_from(context))
end

.configObject



17
18
19
# File 'lib/rails-console/config.rb', line 17

def config
  self
end

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (RailsConsole)

    the object that the method was called on



21
22
23
# File 'lib/rails-console/config.rb', line 21

def configure
  yield(self)
end

.default_socket_pathObject



25
26
27
# File 'lib/rails-console/config.rb', line 25

def default_socket_path
  Rails.root.join('tmp/sockets/rails_console.sock')
end

.user_from(context) ⇒ Object



8
9
10
11
12
# File 'lib/rails-console/user.rb', line 8

def self.user_from(context)
  return context.current_user if context.respond_to?(:current_user)

  context.env['warden']&.user
end