Class: CiteProc::Ruby::Renderer::State
- Inherits:
-
Object
- Object
- CiteProc::Ruby::Renderer::State
- Includes:
- Observable
- Defined in:
- lib/citeproc/ruby/renderer/state.rb
Instance Attribute Summary collapse
-
#authors ⇒ Object
readonly
Returns the value of attribute authors.
-
#history ⇒ Object
readonly
Returns the value of attribute history.
-
#item ⇒ Object
readonly
Returns the value of attribute item.
-
#node ⇒ Object
readonly
Returns the value of attribute node.
-
#substitute ⇒ Object
readonly
Returns the value of attribute substitute.
Instance Method Summary collapse
- #clear!(result = nil) ⇒ Object
- #clear_substitute!(backup = nil) ⇒ Object
- #conserve(result = nil) ⇒ Object
-
#initialize ⇒ State
constructor
A new instance of State.
- #mode ⇒ Object
- #previous_authors ⇒ Object
- #rendered_names! ⇒ Object
- #rendered_names? ⇒ Boolean
- #reset ⇒ Object
- #store!(item, node) ⇒ Object
- #store_authors!(authors) ⇒ Object
- #substitute!(names) ⇒ Object
Constructor Details
Instance Attribute Details
#authors ⇒ Object (readonly)
Returns the value of attribute authors.
31 32 33 |
# File 'lib/citeproc/ruby/renderer/state.rb', line 31 def @authors end |
#history ⇒ Object (readonly)
Returns the value of attribute history.
31 32 33 |
# File 'lib/citeproc/ruby/renderer/state.rb', line 31 def history @history end |
#item ⇒ Object (readonly)
Returns the value of attribute item.
31 32 33 |
# File 'lib/citeproc/ruby/renderer/state.rb', line 31 def item @item end |
#node ⇒ Object (readonly)
Returns the value of attribute node.
31 32 33 |
# File 'lib/citeproc/ruby/renderer/state.rb', line 31 def node @node end |
#substitute ⇒ Object (readonly)
Returns the value of attribute substitute.
31 32 33 |
# File 'lib/citeproc/ruby/renderer/state.rb', line 31 def substitute @substitute end |
Instance Method Details
#clear!(result = nil) ⇒ Object
50 51 52 53 54 55 |
# File 'lib/citeproc/ruby/renderer/state.rb', line 50 def clear!(result = nil) memories = conserve(result) reset ensure notify_observers :clear!, memories.delete(:mode), memories end |
#clear_substitute!(backup = nil) ⇒ Object
72 73 74 |
# File 'lib/citeproc/ruby/renderer/state.rb', line 72 def clear_substitute!(backup = nil) @substitute = backup end |
#conserve(result = nil) ⇒ Object
91 92 93 94 95 96 97 98 |
# File 'lib/citeproc/ruby/renderer/state.rb', line 91 def conserve(result = nil) { :mode => mode, :item => item, :authors => , :result => result } end |
#mode ⇒ Object
64 65 66 |
# File 'lib/citeproc/ruby/renderer/state.rb', line 64 def mode node && node.nodename end |
#previous_authors ⇒ Object
76 77 78 79 80 81 |
# File 'lib/citeproc/ruby/renderer/state.rb', line 76 def past = history.recall(mode) return unless past && !past.empty? past[:authors] end |
#rendered_names! ⇒ Object
87 88 89 |
# File 'lib/citeproc/ruby/renderer/state.rb', line 87 def rendered_names! @names = true end |
#rendered_names? ⇒ Boolean
83 84 85 |
# File 'lib/citeproc/ruby/renderer/state.rb', line 83 def rendered_names? @names end |
#reset ⇒ Object
57 58 59 60 61 62 |
# File 'lib/citeproc/ruby/renderer/state.rb', line 57 def reset @item, @node, @substitute, @authors, @names = nil, nil, nil, [], nil self ensure changed end |
#store!(item, node) ⇒ Object
38 39 40 41 42 |
# File 'lib/citeproc/ruby/renderer/state.rb', line 38 def store!(item, node) @item, @node = item, node ensure changed end |
#store_authors!(authors) ⇒ Object
44 45 46 47 48 |
# File 'lib/citeproc/ruby/renderer/state.rb', line 44 def () @authors << ensure changed end |
#substitute!(names) ⇒ Object
68 69 70 |
# File 'lib/citeproc/ruby/renderer/state.rb', line 68 def substitute!(names) @substitute = names end |