lib/dub/function.rb in dub-0.6.6 vs lib/dub/function.rb in dub-0.7.0

- old
+ new

@@ -2,16 +2,16 @@ require 'dub/entities_unescape' module Dub class Function include Dub::EntitiesUnescape - attr_reader :arguments, :prefix, :overloaded_index, :return_value, :xml, :parent - attr_accessor :gen, :name, :is_constructor + attr_reader :arguments, :prefix, :return_value, :xml, :parent + attr_accessor :gen, :name, :is_constructor, :overloaded_index - def initialize(parent, name, xml, prefix = '', overloaded_index = nil) + def initialize(parent, name, xml, prefix = '') @parent, @name = parent, name - @xml, @prefix, @overloaded_index = xml, prefix, overloaded_index + @xml, @prefix = xml, prefix parse_xml parse_template_params end def set_as_constructor @@ -41,10 +41,16 @@ def constructor? @is_constructor end + def throws? + @throw ||= (@xml/'exceptions').innerHTML || '' + @throw = (@throw =~ /throw\s*\(\s*\)/) ? :nothing : :any + @throw != :nothing + end + def static? @is_static end alias gen generator @@ -106,9 +112,13 @@ @arguments[count_position].is_list_count = true end def template? !@template_params.nil? + end + + def public? + @xml[:prot] == 'public' end def template_params @template_params end