Class: Clickwrap::Presenter::Combined

Inherits:
Data
  • Object
show all
Defined in:
lib/clickwrap/presenter.rb

Overview

The one control and the one sentence a composable policy renders. It is not a statement and never becomes one: the statements it covers keep their own kinds, documents, answers, and lifecycles in the evidence. What this object describes is the offer a person saw.

It answers everything a Statement answers about a CONTROL — the name, the id, the error id, whether it is required, whether it has choices — so the reference views render one control the same way whether it stands for one act or three, and a host's ejected statement partial styles both. What it does not answer is anything about an act, because it is not one.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#control_idObject (readonly)

Returns the value of attribute control_id

Returns:

  • (Object)

    the current value of control_id



57
58
59
# File 'lib/clickwrap/presenter.rb', line 57

def control_id
  @control_id
end

#control_nameObject (readonly)

Returns the value of attribute control_name

Returns:

  • (Object)

    the current value of control_name



57
58
59
# File 'lib/clickwrap/presenter.rb', line 57

def control_name
  @control_name
end

#error_idObject (readonly)

Returns the value of attribute error_id

Returns:

  • (Object)

    the current value of error_id



57
58
59
# File 'lib/clickwrap/presenter.rb', line 57

def error_id
  @error_id
end

#fragmentsObject (readonly)

Returns the value of attribute fragments

Returns:

  • (Object)

    the current value of fragments



57
58
59
# File 'lib/clickwrap/presenter.rb', line 57

def fragments
  @fragments
end

#joinerObject (readonly)

Returns the value of attribute joiner

Returns:

  • (Object)

    the current value of joiner



57
58
59
# File 'lib/clickwrap/presenter.rb', line 57

def joiner
  @joiner
end

#sentenceObject (readonly)

Returns the value of attribute sentence

Returns:

  • (Object)

    the current value of sentence



57
58
59
# File 'lib/clickwrap/presenter.rb', line 57

def sentence
  @sentence
end

#statement_keysObject (readonly)

Returns the value of attribute statement_keys

Returns:

  • (Object)

    the current value of statement_keys



57
58
59
# File 'lib/clickwrap/presenter.rb', line 57

def statement_keys
  @statement_keys
end

#terminatorObject (readonly)

Returns the value of attribute terminator

Returns:

  • (Object)

    the current value of terminator



57
58
59
# File 'lib/clickwrap/presenter.rb', line 57

def terminator
  @terminator
end

Instance Method Details

#answered_asObject

The statement whose name the single control carries. Every covered statement is answered by it; this is the one whose key it is submitted under, so a browser sends one value and the server fans it out.



89
# File 'lib/clickwrap/presenter.rb', line 89

def answered_as = statement_keys.first

#assertionObject

The words, without their links. The views render the linked form through clickwrap_statement_label; this is for anything reading the offer as text.



79
# File 'lib/clickwrap/presenter.rb', line 79

def assertion = sentence

#checkbox?Boolean

Returns:

  • (Boolean)


67
# File 'lib/clickwrap/presenter.rb', line 67

def checkbox? = true

#choicesObject



68
# File 'lib/clickwrap/presenter.rb', line 68

def choices = nil

#covers?(statement_key) ⇒ Boolean

Returns:

  • (Boolean)


59
# File 'lib/clickwrap/presenter.rb', line 59

def covers?(statement_key) = statement_keys.include?(statement_key.to_s)

#documentsObject

The links live inside the sentence, so there is no list of documents to render beneath it.



83
# File 'lib/clickwrap/presenter.rb', line 83

def documents = [].freeze

#kindObject

Composed, so there is no single kind — and "combined" is what the rendered class name should say, because that is what a person is looking at.



74
# File 'lib/clickwrap/presenter.rb', line 74

def kind = "combined"

#optional?Boolean

Returns:

  • (Boolean)


66
# File 'lib/clickwrap/presenter.rb', line 66

def optional? = false

#required?Boolean

Always. Only required statements compose, so the single control is required too — which also lets a custom surface pass this object to clickwrap_statement_check_box and get the same markup contract a statement gets.

Returns:

  • (Boolean)


65
# File 'lib/clickwrap/presenter.rb', line 65

def required? = true

#requires_an_explicit_choice?Boolean

Returns:

  • (Boolean)


69
# File 'lib/clickwrap/presenter.rb', line 69

def requires_an_explicit_choice? = false

#withdrawal_pathObject



84
# File 'lib/clickwrap/presenter.rb', line 84

def withdrawal_path = nil