lib/wlang/dialect.rb in wlang-0.8.5 vs lib/wlang/dialect.rb in wlang-0.9.1

- old
+ new

@@ -1,21 +1,22 @@ require 'wlang/encoder_set' require 'wlang/rule_set' module WLang # - # Implements the _dialect_ abstraction (see {README}[link://files/README.html]). - # A dialect instance is a aggregation of encoders and ruleset (through EncoderSet + # Implements the _dialect_ abstraction (see {README}[link://files/README.rdoc]). + # A dialect instance is an aggregation of encoders and ruleset (through EncoderSet # and RuleSet classes). A dialect is also a node in the dialect tree and has a # qualified name through this tree. For example <tt>wlang/xhtml</tt> is the # qualified name of a <tt>xhtml</tt> dialect which is a child dialect of # <tt>wlang</tt>. # # Users are not intended to use this class directly. Use the Domain Specific # Language instead (see WLang::Dialect::DSL). # # === For developers only + # # In order to avoid having users to install all required gems of all dialects # wlang implements a lazy load design pattern on the dialect tree, through the # WLang::Dialect::DSL and WLang::Dialect::Loader classes. The former only creates # Dialect instances as tree nodes (by chaining dialects through @parent) and # installs mapping with file extensions. Rules and encoders are not initially @@ -24,11 +25,11 @@ # method and the WLang::Dialect::Loader class). # # Standard dialect obtention methods (WLang#dialect as well as WLang::Dialect#dialect) # ensure that returned dialects are built. If you obtain dialects another way, # be sure that they are built before using them (is_built? and build! are your - # friends to achive that goal). + # friends to achieve that goal). # # Moreover, child dialects may require tools of their ancestors. The following # invariant should always be respected: if a dialect is built, all its ancestors # are built as well. This invariant is not enforced by the build! method because # it is trivially respected by the way WLang::Dialect#dialect is implemented. @@ -44,9 +45,12 @@ # Dialect name attr_reader :name # Parent dialect attr_reader :parent + + # Sub dialects by name + attr_reader :dialects # # Creates a dialect instance. _builder_ block is a chunk of code of the DSL # that will be executed twice: once at construction time to create sub dialects # nodes and install file extensions and once at building time to install ruleset \ No newline at end of file