Loading lib/jsduck/tag/chainable.rb→lib/jsduck/builtins/chainable.rb +15 −0 Original line number Diff line number Diff line require "jsduck/meta_tag" require "jsduck/builtins/boolean_tag" module JsDuck::Tag # Implementation of @chainable tag class Chainable < JsDuck::MetaTag module JsDuck::Builtins class Chainable < BooleanTag def initialize @name = "chainable" @key = :chainable @signature = {:long => "chainable", :short => ">"} # show small right-arrow @boolean = true super end # When the tag is found, its value will always be true. def process_doc(docs) true end end end lib/jsduck/merger.rb +1 −1 Original line number Diff line number Diff line Loading @@ -58,7 +58,7 @@ module JsDuck def merge_like_method(docs, code) h = do_merge(docs, code) h[:params] = merge_params(docs, code) h[:meta][:chainable] = code[:chainable] if code[:chainable] h[:chainable] = code[:chainable] if code[:chainable] h end Loading lib/jsduck/return_values.rb +2 −2 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ module JsDuck end def chainable?(m) m[:meta][:chainable] m[:chainable] end def returns_this?(m) Loading @@ -50,7 +50,7 @@ module JsDuck end def add_chainable(m) m[:meta][:chainable] = true m[:chainable] = true end def add_return_this(m) Loading spec/aggregator_chainable_spec.rb +11 −11 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ describe JsDuck::Aggregator do end it "detects method as chainable" do cls[:members][0][:meta][:chainable].should == true cls[:members][0][:chainable].should == true end it "keeps the original @return docs" do Loading @@ -50,7 +50,7 @@ describe JsDuck::Aggregator do end it "detects method as chainable" do cls[:members][0][:meta][:chainable].should == true cls[:members][0][:chainable].should == true end it "adds @return {MyClass} this" do Loading Loading @@ -78,7 +78,7 @@ describe JsDuck::Aggregator do end it "adds @chainable tag" do cls[:members][0][:meta][:chainable].should == true cls[:members][0][:chainable].should == true end end Loading @@ -101,7 +101,7 @@ describe JsDuck::Aggregator do end it "adds @chainable tag" do cls[:members][0][:meta][:chainable].should == true cls[:members][0][:chainable].should == true end end Loading @@ -119,7 +119,7 @@ describe JsDuck::Aggregator do end it "doesn't add @chainable tag" do cls[:members][0][:meta][:chainable].should_not == true cls[:members][0][:chainable].should_not == true end end Loading @@ -137,7 +137,7 @@ describe JsDuck::Aggregator do end it "doesn't add @chainable tag" do cls[:members][0][:meta][:chainable].should_not == true cls[:members][0][:chainable].should_not == true end end Loading @@ -155,7 +155,7 @@ describe JsDuck::Aggregator do end it "doesn't add @chainable tag" do cls[:members][0][:meta][:chainable].should_not == true cls[:members][0][:chainable].should_not == true end end Loading @@ -170,7 +170,7 @@ describe JsDuck::Aggregator do end it "doesn't add @chainable tag" do cls[:members][0][:meta][:chainable].should_not == true cls[:members][0][:chainable].should_not == true end end Loading @@ -186,7 +186,7 @@ describe JsDuck::Aggregator do end it "doesn't add @chainable tag" do cls[:members][0][:meta][:chainable].should_not == true cls[:members][0][:chainable].should_not == true end end Loading @@ -202,7 +202,7 @@ describe JsDuck::Aggregator do end it "adds @chainable tag" do cls[:members][0][:meta][:chainable].should == true cls[:members][0][:chainable].should == true end it "adds @return {MyClass} this" do Loading Loading @@ -275,7 +275,7 @@ describe JsDuck::Aggregator do end it "doesn't get @chainable tag" do cls[:members][0][:meta][:chainable].should_not == true cls[:members][0][:chainable].should_not == true end end Loading Loading
lib/jsduck/tag/chainable.rb→lib/jsduck/builtins/chainable.rb +15 −0 Original line number Diff line number Diff line require "jsduck/meta_tag" require "jsduck/builtins/boolean_tag" module JsDuck::Tag # Implementation of @chainable tag class Chainable < JsDuck::MetaTag module JsDuck::Builtins class Chainable < BooleanTag def initialize @name = "chainable" @key = :chainable @signature = {:long => "chainable", :short => ">"} # show small right-arrow @boolean = true super end # When the tag is found, its value will always be true. def process_doc(docs) true end end end
lib/jsduck/merger.rb +1 −1 Original line number Diff line number Diff line Loading @@ -58,7 +58,7 @@ module JsDuck def merge_like_method(docs, code) h = do_merge(docs, code) h[:params] = merge_params(docs, code) h[:meta][:chainable] = code[:chainable] if code[:chainable] h[:chainable] = code[:chainable] if code[:chainable] h end Loading
lib/jsduck/return_values.rb +2 −2 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ module JsDuck end def chainable?(m) m[:meta][:chainable] m[:chainable] end def returns_this?(m) Loading @@ -50,7 +50,7 @@ module JsDuck end def add_chainable(m) m[:meta][:chainable] = true m[:chainable] = true end def add_return_this(m) Loading
spec/aggregator_chainable_spec.rb +11 −11 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ describe JsDuck::Aggregator do end it "detects method as chainable" do cls[:members][0][:meta][:chainable].should == true cls[:members][0][:chainable].should == true end it "keeps the original @return docs" do Loading @@ -50,7 +50,7 @@ describe JsDuck::Aggregator do end it "detects method as chainable" do cls[:members][0][:meta][:chainable].should == true cls[:members][0][:chainable].should == true end it "adds @return {MyClass} this" do Loading Loading @@ -78,7 +78,7 @@ describe JsDuck::Aggregator do end it "adds @chainable tag" do cls[:members][0][:meta][:chainable].should == true cls[:members][0][:chainable].should == true end end Loading @@ -101,7 +101,7 @@ describe JsDuck::Aggregator do end it "adds @chainable tag" do cls[:members][0][:meta][:chainable].should == true cls[:members][0][:chainable].should == true end end Loading @@ -119,7 +119,7 @@ describe JsDuck::Aggregator do end it "doesn't add @chainable tag" do cls[:members][0][:meta][:chainable].should_not == true cls[:members][0][:chainable].should_not == true end end Loading @@ -137,7 +137,7 @@ describe JsDuck::Aggregator do end it "doesn't add @chainable tag" do cls[:members][0][:meta][:chainable].should_not == true cls[:members][0][:chainable].should_not == true end end Loading @@ -155,7 +155,7 @@ describe JsDuck::Aggregator do end it "doesn't add @chainable tag" do cls[:members][0][:meta][:chainable].should_not == true cls[:members][0][:chainable].should_not == true end end Loading @@ -170,7 +170,7 @@ describe JsDuck::Aggregator do end it "doesn't add @chainable tag" do cls[:members][0][:meta][:chainable].should_not == true cls[:members][0][:chainable].should_not == true end end Loading @@ -186,7 +186,7 @@ describe JsDuck::Aggregator do end it "doesn't add @chainable tag" do cls[:members][0][:meta][:chainable].should_not == true cls[:members][0][:chainable].should_not == true end end Loading @@ -202,7 +202,7 @@ describe JsDuck::Aggregator do end it "adds @chainable tag" do cls[:members][0][:meta][:chainable].should == true cls[:members][0][:chainable].should == true end it "adds @return {MyClass} this" do Loading Loading @@ -275,7 +275,7 @@ describe JsDuck::Aggregator do end it "doesn't get @chainable tag" do cls[:members][0][:meta][:chainable].should_not == true cls[:members][0][:chainable].should_not == true end end Loading