lib/inch/language/elixir/provider/reader/object/base.rb in inch-0.5.0.rc5 vs lib/inch/language/elixir/provider/reader/object/base.rb in inch-0.5.0.rc6
- old
+ new
@@ -1,5 +1,7 @@
+require 'inch/language/elixir/provider/reader/docstring'
+
module Inch
module Language
module Elixir
module Provider
module Reader
@@ -14,27 +16,32 @@
def name
@hash['name']
end
def fullname
- raise NotImplementedError
+ fail NotImplementedError
end
def files
[]
end
def filename
nil
end
+ attr_writer :children_fullnames
def children_fullnames
- [] # raise NotImplementedError
+ @children_fullnames ||= []
end
def parent_fullname
- false # raise NotImplementedError
+ if depth == 1
+ nil
+ else
+ fullname.split('.')[0...-1].join('.')
+ end
end
def api_tag?
nil
end
@@ -65,19 +72,20 @@
def depth
fullname.split('.').size
end
+ # @return [Docstring]
def docstring
- @hash['doc'] # raise NotImplementedError
+ @docstring ||= Docstring.new(@hash['doc'])
end
def getter?
name =~ /^get_/ # raise NotImplementedError
end
def has_children?
- false # raise NotImplementedError
+ !children_fullnames.empty?
end
def has_code_example?
false # raise NotImplementedError
end