Class: DSLCompose::ReaderBase
- Inherits:
-
Object
- Object
- DSLCompose::ReaderBase
- Defined in:
- lib/dsl_compose/reader_base.rb
Overview
This class provides a skeleton for creating your own DSL readers.
All classes which extend from this base class must follow a strict naming convention. The class name must be the camelcased form of the DSL name, followed by the string “DSLReader”. For example, a reader for a DLS named ‘:foo_bar` must have the class name `FooBarDSLReader`, as seen below
class FooBarDSLReader < DSLCompose::ReaderBase
# ...
end
Instance Attribute Summary collapse
-
#base_class ⇒ Object
readonly
Returns the value of attribute base_class.
-
#dsl_name ⇒ Object
readonly
Returns the value of attribute dsl_name.
-
#reader ⇒ Object
readonly
Returns the value of attribute reader.
Instance Method Summary collapse
-
#initialize(base_class) ⇒ ReaderBase
constructor
A new instance of ReaderBase.
Constructor Details
#initialize(base_class) ⇒ ReaderBase
Returns a new instance of ReaderBase.
16 17 18 19 20 21 22 |
# File 'lib/dsl_compose/reader_base.rb', line 16 def initialize base_class @base_class = base_class # get the DSL name from the class name @dsl_name = dsl_name_from_class_name self.class # create the reader @reader = DSLCompose::Reader.new(base_class, @dsl_name) end |
Instance Attribute Details
#base_class ⇒ Object (readonly)
Returns the value of attribute base_class.
12 13 14 |
# File 'lib/dsl_compose/reader_base.rb', line 12 def base_class @base_class end |
#dsl_name ⇒ Object (readonly)
Returns the value of attribute dsl_name.
13 14 15 |
# File 'lib/dsl_compose/reader_base.rb', line 13 def dsl_name @dsl_name end |
#reader ⇒ Object (readonly)
Returns the value of attribute reader.
14 15 16 |
# File 'lib/dsl_compose/reader_base.rb', line 14 def reader @reader end |