class Flor::Pro::Strings
Public Instance Methods
pre_execute()
click to toggle source
# File lib/flor/pcore/strings.rb, line 49 def pre_execute @node['ret'] = nil @node['atts'] = [] unatt_unkeyed_children end
receive_last()
click to toggle source
# File lib/flor/pcore/strings.rb, line 59 def receive_last met = case heap when 'downcase', 'lowercase', 'lowcase' then :downcase when 'upcase', 'uppercase' then :upcase when 'capitalize' then :capitalize when 'strip', 'trim' then :strip when 'snakecase', 'snake_case' then :snakecase when 'camelcase', 'camelCase' then :camelcase else fail NotImplementedError.new("#{heap.inspect} not implemented") end ret = process( met, @node['ret'] || node_payload_ret, att('cap', 'capitalize')) wrap('ret' => ret) end
receive_payload_ret()
click to toggle source
# File lib/flor/pcore/strings.rb, line 57 def receive_payload_ret; payload['ret']; end
Protected Instance Methods
process(met, o, cap)
click to toggle source
# File lib/flor/pcore/strings.rb, line 82 def process(met, o, cap) r = case o when String then StringWrapper.new(o).send(met) when Array then o.collect { |e| process(met, e, cap) } when Hash then o.inject({}) { |h, (k, v)| h[k] = process(met, v, cap); h } else o end cap ? r.capitalize : r end