Module: Boson::Command::Libraries

Included in:
Boson::Command
Defined in:
lib/boson/libraries.rb

Instance Method Summary collapse

Instance Method Details

#file_string_and_method_for_args(lib) ⇒ Object



144
145
146
147
148
149
150
151
152
153
154
# File 'lib/boson/libraries.rb', line 144

def file_string_and_method_for_args(lib)
  if !lib.is_a?(ModuleLibrary) && (klass_method = (lib.class_commands || {})[@name])
    klass, meth = klass_method.split(NAMESPACE, 2)
    if (meth_locations = MethodInspector.find_class_method_locations(klass, meth))
      file_string = File.read meth_locations[0]
    end
  elsif File.exists?(lib.library_file || '')
    file_string, meth = FileLibrary.read_library_file(lib.library_file), @name
  end
  [file_string, meth]
end