Tab#tap: returns tap object

This commit is contained in:
Xu Cheng 2015-12-06 22:33:41 +08:00
parent 5debd5b132
commit 72f4323ea5

View File

@ -28,7 +28,7 @@ class Tab < OpenStruct
"stdlib" => stdlib,
"source" => {
"path" => formula.path.to_s,
"tap" => formula.tap,
"tap" => formula.tap ? formula.tap.name : nil,
"spec" => formula.active_spec_sym.to_s
}
}
@ -116,7 +116,11 @@ class Tab < OpenStruct
else
tab = empty
tab.unused_options = f.options.as_flags
tab.source = { "path" => f.path.to_s, "tap" => f.tap, "spec" => f.active_spec_sym.to_s }
tab.source = {
"path" => f.path.to_s,
"tap" => f.tap ? f.tap.name : f.tap,
"spec" => f.active_spec_sym.to_s,
}
end
tab
@ -194,11 +198,13 @@ class Tab < OpenStruct
end
def tap
source["tap"]
tap_name = source["tap"]
Tap.fetch(tap_name) if tap_name
end
def tap=(tap)
source["tap"] = tap
tap_name = tap.respond_to?(:name) ? tap.name : tap
source["tap"] = tap_name
end
def spec