Class: Brief::Document::Section::Mapping
- Inherits:
-
Object
- Object
- Brief::Document::Section::Mapping
- Defined in:
- lib/brief/document/section/mapping.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
- #each(*args, &_block) ⇒ Object
- #has(*args) ⇒ Object
- #heading(*args, &block) ⇒ Object
-
#initialize(title, options = {}) ⇒ Mapping
constructor
A new instance of Mapping.
- #is_a(*args) ⇒ Object
- #selector ⇒ Object
- #selector_config ⇒ Object
- #selectors ⇒ Object
Constructor Details
#initialize(title, options = {}) ⇒ Mapping
Returns a new instance of Mapping.
3 4 5 6 7 |
# File 'lib/brief/document/section/mapping.rb', line 3 def initialize(title, = {}) @title = title = @config = {}.to_mash end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
17 18 19 |
# File 'lib/brief/document/section/mapping.rb', line 17 def config @config end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
19 20 21 |
# File 'lib/brief/document/section/mapping.rb', line 19 def end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
21 22 23 |
# File 'lib/brief/document/section/mapping.rb', line 21 def title @title end |
Instance Method Details
#each(*args, &_block) ⇒ Object
27 28 29 30 |
# File 'lib/brief/document/section/mapping.rb', line 27 def each(*args, &_block) @selector = args.first self end |
#has(*args) ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/brief/document/section/mapping.rb', line 36 def has(*args) = args. unless .empty? config.selectors ||= {} config.selectors.merge!(selector => ) end self end |
#heading(*args, &block) ⇒ Object
32 33 34 |
# File 'lib/brief/document/section/mapping.rb', line 32 def heading(*args, &block) send(:each, *args, &block) end |
#is_a(*args) ⇒ Object
47 48 49 50 51 52 53 |
# File 'lib/brief/document/section/mapping.rb', line 47 def is_a(*args) = args. klass = args.first [:is_a] = klass if klass self end |
#selector ⇒ Object
23 24 25 |
# File 'lib/brief/document/section/mapping.rb', line 23 def selector @selector || :next end |
#selector_config ⇒ Object
13 14 15 |
# File 'lib/brief/document/section/mapping.rb', line 13 def selector_config config.selectors end |
#selectors ⇒ Object
9 10 11 |
# File 'lib/brief/document/section/mapping.rb', line 9 def selectors selector_config.keys end |