首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >列出Merb::片依赖关系的最佳方法?

列出Merb::片依赖关系的最佳方法?
EN

Stack Overflow用户
提问于 2008-11-22 00:42:58
回答 3查看 196关注 0票数 1

我正在我的Merb应用程序中创建一个切片列表,如下所示:

Merb::Slices.each_slice do \x\x{e76f}

我想得到每个片段的依赖项列表,知道如何访问它吗?

我仍在阅读merb代码,解决方案可能很快就会出现;)

EN

回答 3

Stack Overflow用户

发布于 2008-11-22 01:58:37

似乎不可能获得特定片段的依赖项列表。

下一个解决方案是解析切片init.rb。

在任务中发现了一些有趣的东西,即依赖项的全局列表:

Merb::BootLoader::Dependencies.dependencies

票数 1
EN

Stack Overflow用户

发布于 2008-11-22 01:05:45

我还没有使用过切片,但据我所知,它们本身就像一个迷你merb应用程序,因此每个切片不都有一个/config/dependencies.rb吗?也许这会被解析到程序中,并且可以在某个地方找到。

可能有些东西是在这里的医生的。

另外,下面是Merb常量上可用的方法(您可以从Merb常量获得环境之类的东西)。有一个叫做依赖项的函数,它返回一个数组(当我在应用程序中运行merb -i时,数组是空的)。

代码语言:javascript
复制
>> Merb.methods.sort
=> ["<", "<=", "<=>", "==", "===", "=~", ">", ">=", "JSON", "__caller_info__", "__caller_lines__", "__id__", "__profile__", "__send__", "abstract_method", "adapter", "adapter=", "add_generators", "add_mime_type", "add_rakefiles", "ancestors", "args_and_options", "assigns", "at_exit", "at_exit_procs", "autoload", "autoload?", "available_accepts", "available_mime_types", "b64encode", "blank?", "bundled?", "class", "class_eval", "class_variable_defined?", "class_variables", "clone", "config", "const_defined?", "const_get", "const_missing", "const_set", "constants", "context", "debugger", "decode64", "decode_b", "deep_clone", "deferred_actions", "dependencies", "dependency", "describe", "dir_for", "disable", "disabled?", "disabled_components", "disabled_components=", "display", "dup", "encode64", "encoded_hash", "enforce!", "enum_for", "env", "env?", "environment", "environment=", "environment_info", "environment_info=", "eql?", "equal?", "exception", "exiting", "exiting=", "extend", "extract_options_from_args!", "fatal!", "find_const", "forking_environment?", "framework_root", "freeze", "frozen?", "full_const_get", "full_const_set", "generators", "given", "glob_for", "hash", "id", "in?", "include?", "included_modules", "inline", "inspect", "instance_eval", "instance_method", "instance_methods", "instance_of?", "instance_variable_defined?", "instance_variable_get", "instance_variable_set", "instance_variables", "is_a?", "is_haml?", "j", "jj", "kind_of?", "klass_hashes", "klass_hashes=", "load_config", "load_dependencies", "load_dependency", "load_paths", "load_paths=", "log_path", "log_stream", "logger", "make_module", "merb", "merge_env", "meta_class", "method", "method_defined?", "methods", "mime_transform_method", "module_eval", "modules", "name", "nil?", "object_id", "on_jruby?", "on_windows?", "options", "orm", "orm=", "orm_generator_scope", "present?", "print_colorized_backtrace", "private_class_method", "private_instance_methods", "private_method_defined?", "private_methods", "protected_instance_methods", "protected_method_defined?", "protected_methods", "public_class_method", "public_instance_methods", "public_method_defined?", "public_methods", "push_path", "quacks_like?", "rakefiles", "reload", "remove_mime_type", "remove_paths", "rescue_require", "reset_logger!", "respond_to?", "restart_environment", "root", "root=", "root_path", "send", "share_as", "share_examples_for", "shared_examples_for", "should", "should_not", "singleton_methods", "start", "start_environment", "started", "started=", "started?", "taguri", "taguri=", "taint", "tainted?", "template_engine", "template_engine=", "test_framework", "test_framework=", "test_framework_generator_scope", "testing?", "to_a", "to_enum", "to_json", "to_s", "to_yaml", "to_yaml_properties", "to_yaml_style", "track_dependency", "trap", "try_dup", "type", "untaint", "use_orm", "use_template_engine", "use_test", "use_testing_framework", "yaml_as", "yaml_tag_class_name", "yaml_tag_read_class"]
票数 0
EN

Stack Overflow用户

发布于 2009-08-27 06:24:43

从理论上讲,你的那部分应该被打包成一块宝石。因此,您可以将依赖项直接从宝石本身中提取出来。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/310642

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档