lib/lucid/ast/feature.rb in lucid-0.0.6 vs lib/lucid/ast/feature.rb in lucid-0.0.7
- old
+ new
@@ -9,10 +9,11 @@
include Names
include HasLocation
attr_accessor :language
attr_reader :feature_elements
+ attr_reader :comment, :background, :tags
def initialize(location, background, comment, tags, keyword, title, description, feature_elements)
@background, @comment, @tags, @keyword, @title, @description, @feature_elements = background, comment, tags, keyword, title, description, feature_elements
@background.feature = self
@location = location
@@ -28,15 +29,17 @@
units.inject(0) { |total, unit| total += unit.step_count }
end
def accept(visitor)
return if Lucid.wants_to_quit
- visitor.visit_comment(@comment) unless @comment.empty?
- visitor.visit_tags(@tags)
- visitor.visit_feature_name(@keyword, indented_name)
- visitor.visit_background(@background) if !@background.is_a?(EmptyBackground)
- @feature_elements.each do |feature_element|
- visitor.visit_feature_element(feature_element)
+ visitor.visit_feature(self) do
+ comment.accept(visitor)
+ tags.accept(visitor)
+ visitor.visit_feature_name(@keyword, indented_name)
+ background.accept(visitor)
+ @feature_elements.each do |feature_element|
+ feature_element.accept(visitor)
+ end
end
end
def indented_name
indent = ""