Skip to content
This repository has been archived by the owner on Jun 30, 2022. It is now read-only.

Commit

Permalink
Update API docs for the config object name changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmycuadra committed Oct 19, 2014
1 parent 5073d20 commit bed3059
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 23 deletions.
7 changes: 4 additions & 3 deletions lib/lita/adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class << self
# @!attribute [r] required_configs
# A list of configuration keys that are required for the adapter to boot.
# @return [Array]
# @deprecated Will be removed in Lita 5.0. Use {Lita::Adapter#configuration} instead.
# @deprecated Will be removed in Lita 5.0. Use {Lita::Adapter#configuration_builder} instead.
def required_configs
Lita.logger.warn(I18n.t("lita.adapter.required_configs_deprecated"))
@required_configs
Expand Down Expand Up @@ -46,7 +46,7 @@ def initialize(robot)
ensure_required_configs
end
#
# The handler's config object.
# The adapter's configuration object.
# @return [Lita::Configuration] The adapter's configuration object.
# @since 4.0.0
def config
Expand Down Expand Up @@ -117,7 +117,7 @@ def translate(*args)

private

# Returns the object used for the adapter's config.
# Returns the object used as the adapter's configuration.
def adapter_config
if Lita.version_3_compatibility_mode?
Lita.config.adapter
Expand Down Expand Up @@ -147,6 +147,7 @@ def missing_config_keys
end
end

# Access the required configs without triggering the deprecation warning.
def required_configs
self.class.instance_variable_get(:@required_configs)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/lita/authorization.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Lita
# Methods for querying and manipulating authorization groups.
class Authorization
# @param config [Object] The finalized configuration object for the currently running robot.
# @param config [Lita::Configuration] The configuration object of the currently running robot.
def initialize(config)
@config = config
end
Expand Down
12 changes: 6 additions & 6 deletions lib/lita/configuration_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ def initialize
@name = :root
end

# Extracts the finalized configuration object as it will be interacted with by the user.
# @param object [Object] The bare object that will be extended to create the final form.
# @return [Object] A bare object with only the methods that were declared via the
# {Lita::ConfigurationBuilder} DSL.
# Builds a {Lita::Configuration} object from the attributes defined on the builder.
# @param object [Lita::Configuration] The empty configuration object that will be extended to
# create the final form.
# @return [Lita::Confirmation] The fully built configuration object.
def build(object = Configuration.new)
container = if children.empty?
build_leaf(object)
Expand Down Expand Up @@ -170,7 +170,7 @@ def build_leaf(object)
object
end

# Finalize the root object.
# Finalize the root builder or any builder with children.
def build_nested(object)
this = self

Expand Down Expand Up @@ -198,7 +198,7 @@ def ensure_valid_default_value(value)
end
end

# Runs the validator from inside the finalized object.
# Runs the validator from inside the build configuration object.
def run_validator(value)
return unless validator

Expand Down
6 changes: 2 additions & 4 deletions lib/lita/default_configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@ def initialize(registry)
robot_config
end

# Processes the {ConfigurationBuilder} object to return a raw object with only the appropriate
# methods.
# This is the value that's actually stored in {Lita::Registry#config}.
# @return [Object] The final form of the configuration object.
# Processes the {Lita::ConfigurationBuilder} object to return a {Lita:Configuration}.
# @return [Lita::Configuration] The built configuration object.
def build
final_config = root.build
add_adapter_attribute(final_config)
Expand Down
6 changes: 3 additions & 3 deletions lib/lita/handler/common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class Handler
# Methods included in any class that includes at least one type of router.
# @since 4.0.0
module Common
# Adds common functionality to the class and initializes the handler's configuration.
# Adds common functionality to the class and initializes the handler's configuration builder.
def self.included(klass)
klass.extend(ClassMethods)
klass.extend(Namespace)
Expand Down Expand Up @@ -48,8 +48,8 @@ def after(interval, &block)
Thread.new { Timer.new(interval: interval, &block).start }
end

# The handler's config object.
# @return [Object, Lita::Config] The handler's configuration object.
# The handler's configuration object.
# @return [Lita::Configuration, Lita::Config] The handler's configuration object.
# @since 3.2.0
def config
if robot.config.handlers.respond_to?(self.class.namespace)
Expand Down
4 changes: 2 additions & 2 deletions lib/lita/registry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ class Registry
# Allows a registry to be added to another object.
module Mixins
# The primary configuration object. Provides user settings for the robot.
# @return [Object] The configuration object.
# @return [Lita::Configuration] The configuration object.
def config
@config ||= DefaultConfiguration.new(self).build
end

# Yields the configuration object. Called by the user in a +lita_config.rb+ file.
# @yieldparam [Object] config The configuration object.
# @yieldparam [Lita::Configuration] config The configuration object.
# @return [void]
def configure
yield config
Expand Down
2 changes: 1 addition & 1 deletion spec/lita/handler/common_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
end
end

describe ".configuration" do
describe ".configuration_builder" do
it "returns a ConfigurationBuilder object" do
expect(handler.configuration_builder).to be_a(Lita::ConfigurationBuilder)
end
Expand Down
4 changes: 2 additions & 2 deletions spec/lita_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
describe Lita do
before { described_class.register_adapter(:shell, Lita::Adapters::Shell) }

it "memoizes a Config" do
it "memoizes a Configuration" do
expect(described_class.config).to eql(described_class.config)
end

Expand All @@ -15,7 +15,7 @@
end

describe ".configure" do
it "yields the Config object" do
it "yields the Configuration object" do
described_class.configure { |c| c.robot.name = "Not Lita" }
expect(described_class.config.robot.name).to eq("Not Lita")
end
Expand Down
2 changes: 1 addition & 1 deletion templates/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ en:
Use Lita::Adapter.config instead.
required_configs_deprecated: >-
Lita::Adapter.required_configs is deprecated and will be removed in Lita 5.0.
Use Lita::Adapter.configuration instead.
Use Lita::Adapter.configuration_builder instead.
cli:
no_gemfile_warning: >-
The default command "start" must be run inside a Lita project. Try running `lita new` to
Expand Down

0 comments on commit bed3059

Please sign in to comment.