Class: BlocklyInterpreter::ExtensionBlocks::TextInflectBlock
- Defined in:
- lib/blockly_interpreter/extension_blocks/text_inflect_block.rb
Constant Summary collapse
- INFLECTIONS =
%w( humanize pluralize singularize titleize camelize classify dasherize deconstantize demodulize parameterize tableize underscore )
Instance Attribute Summary
Attributes inherited from Block
#block_type, #comment, #comment_pinned, #fields, #is_shadow, #mutation, #next_block, #statements, #values, #x, #y
Instance Method Summary collapse
Methods inherited from Block
#each_block, #execute_statement, #has_comment?, #has_position?, #initialize, #to_dsl, #to_xml, #to_xml_element
Constructor Details
This class inherits a constructor from BlocklyInterpreter::Block
Instance Method Details
#value(execution_context) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/blockly_interpreter/extension_blocks/text_inflect_block.rb', line 19 def value(execution_context) text = values['TEXT'].value(execution_context) case fields['OP'] when *INFLECTIONS then text.public_send(fields['OP']) else text end end |