Class: Aska::Rule

Inherits:
String show all
Defined in:
lib/poolparty/aska/aska.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from String

#^, #_allowed, #_grab_key_value_for, #arrayable, #camelcase, #camelize, #class_constant, #classify, #collect_each_line_with_index, #constantize, #convert_from_ec2_to_ip, #dasherize, #dir_safe, #grab_entry_for, #grab_filename_from_caller_trace, #grab_key_value_for, #hasherize, #keyerize, #macify, #module_constant, #new_resource_class, #nice_runnable, #parse_datetime, #preserved_class_constant, #preserved_module_constant, #runnable, #safe_quote, #sanitize, #snake_case, #to_hash, #top_level_class, #underscore

Methods included from S3String

#bucket_exists?, #bucket_object, #bucket_object_exists?, #bucket_objects, #delete_bucket, #delete_bucket_value, #store_bucket_value

Constructor Details

#initialize(v) ⇒ Rule

Returns a new instance of Rule.



116
117
118
# File 'lib/poolparty/aska/aska.rb', line 116

def initialize(v)
  @value = v
end

Instance Attribute Details

#valueObject

Returns the value of attribute value.



114
115
116
# File 'lib/poolparty/aska/aska.rb', line 114

def value
  @value
end

Instance Method Details

#comparisonObject



125
126
127
# File 'lib/poolparty/aska/aska.rb', line 125

def comparison
  value[/[=\\<>]/, 0].gsub(/\s+/, '')
end

#keyObject



122
123
124
# File 'lib/poolparty/aska/aska.rb', line 122

def key
  value[/(.+)[=\\\<\>](.*)/, 1].gsub(/\s+/, '')
end

#valid?Boolean

Returns:

  • (Boolean)


119
120
121
# File 'lib/poolparty/aska/aska.rb', line 119

def valid?
  value =~ /(.+)[=\\\<\>](.*)/
end

#varObject



128
129
130
# File 'lib/poolparty/aska/aska.rb', line 128

def var
  value[/(.+)[=\\<>](.*)/, 2].gsub(/\s+/, '')
end