Class: CML::Tags::Option
Constant Summary collapse
- Template =
<<-HTML.freeze <option {{value}} {{selected}}>{{label}}</option> HTML
Constants included from CML::TagLogic
CML::TagLogic::And, CML::TagLogic::AndPhraseExp, CML::TagLogic::CombinatorDefault, CML::TagLogic::CombinatorDict, CML::TagLogic::CombinatorExp, CML::TagLogic::GroupExp, CML::TagLogic::Or, CML::TagLogic::OrCombinatorExp, CML::TagLogic::PrecedenceRegexp, CML::TagLogic::TokenExp, CML::TagLogic::TokenRegexp
Instance Attribute Summary
Attributes inherited from CML::Tag
Attributes included from CML::TagLogic
#errors, #has_grouped_logic, #has_liquid_logic, #logic_tree
Instance Method Summary collapse
- #data ⇒ Object
- #in_logic_graph? ⇒ Boolean
- #selected=(selected) ⇒ Object
- #value ⇒ Object
- #wrapper(parsed) ⇒ Object
Methods inherited from CML::Tag
#cacheable?, #children, #classes, #convert, #ensure_resolved, #finite_value?, #gold=, #gold?, #gold_class, #gold_reason, #initialize, #instructions, #iterating?, #label, #legend, memoize, #multi_type, #name, #parent_multiples, #prefix, #preloaded_data, #raw_label, #to_html, #to_liquid, #to_s, #validate?, #validations, #validators, #wrapper_classes
Methods included from CML::TagLogic
#dependencies_on_fields, #dependencies_through_cml_group, #depends_on_fields, #describe_logic_token, #detect_grouped_logic, #detect_liquid_logic, #each_logic_token_in, #expand_logic, #expand_parsed_expression, #keep_merge!, #only_if, parse_expression, resolve_combinator
Constructor Details
This class inherits a constructor from CML::Tag
Instance Method Details
#data ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/cml/tags/option.rb', line 24 def data super.merge({ "value" => @attrs["value"] ? "value=\"#{@attrs["value"]}\"" : "", "selected" => @attrs["selected"] ? "selected=\"selected\"" : "", "label" => (@attrs["label"] || @cml.inner_html).to_s }) end |
#in_logic_graph? ⇒ Boolean
8 9 10 |
# File 'lib/cml/tags/option.rb', line 8 def in_logic_graph? false end |
#selected=(selected) ⇒ Object
20 21 22 |
# File 'lib/cml/tags/option.rb', line 20 def selected=(selected) @attrs["selected"] = selected end |
#value ⇒ Object
16 17 18 |
# File 'lib/cml/tags/option.rb', line 16 def value (@attrs["value"] || @attrs["label"]).to_s end |
#wrapper(parsed) ⇒ Object
12 13 14 |
# File 'lib/cml/tags/option.rb', line 12 def wrapper(parsed) parsed end |