Class: Authorization::DevelopmentSupport::ChangeSupporter::AbstractAction
- Inherits:
-
Object
- Object
- Authorization::DevelopmentSupport::ChangeSupporter::AbstractAction
show all
- Defined in:
- lib/declarative_authorization/development_support/change_supporter.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.readable_info(info) ⇒ Object
232
233
234
235
236
237
238
|
# File 'lib/declarative_authorization/development_support/change_supporter.rb', line 232
def self.readable_info (info)
if info.respond_to?(:to_sym)
info.to_sym.inspect
else
info.inspect
end
end
|
.specific_actions(candidate) ⇒ Object
returns a list of instances of the action that may be applied
194
195
196
|
# File 'lib/declarative_authorization/development_support/change_supporter.rb', line 194
def self.specific_actions (candidate)
raise NotImplementedError, "Not yet?"
end
|
Instance Method Details
#apply(candidate) ⇒ Object
applies the specific action on the given candidate
199
200
201
|
# File 'lib/declarative_authorization/development_support/change_supporter.rb', line 199
def apply (candidate)
raise NotImplementedError, "Not yet?"
end
|
#eql?(other) ⇒ Boolean
203
204
205
|
# File 'lib/declarative_authorization/development_support/change_supporter.rb', line 203
def eql? (other)
other.class == self.class and hash == other.hash
end
|
#hash ⇒ Object
207
208
209
|
# File 'lib/declarative_authorization/development_support/change_supporter.rb', line 207
def hash
@hash ||= to_a.hash
end
|
#inspect ⇒ Object
215
216
217
|
# File 'lib/declarative_authorization/development_support/change_supporter.rb', line 215
def inspect
"#{self.class.name.demodulize} #{hash} #{to_a.hash} (#{to_a[1..-1].collect {|info| self.class.readable_info(info)} * ','})"
end
|
#resembles?(spec) ⇒ Boolean
223
224
225
226
|
# File 'lib/declarative_authorization/development_support/change_supporter.rb', line 223
def resembles? (spec)
min_length = [spec.length, to_a.length].min
to_a[0,min_length] == spec[0,min_length]
end
|
#resembles_any?(specs) ⇒ Boolean
228
229
230
|
# File 'lib/declarative_authorization/development_support/change_supporter.rb', line 228
def resembles_any? (specs)
specs.any? {|spec| resembles?(spec) }
end
|
#reverse?(other) ⇒ Boolean
211
212
213
|
# File 'lib/declarative_authorization/development_support/change_supporter.rb', line 211
def reverse? (other)
false
end
|
#to_a ⇒ Object
219
220
221
|
# File 'lib/declarative_authorization/development_support/change_supporter.rb', line 219
def to_a
[:abstract]
end
|
#weight ⇒ Object
189
190
191
|
# File 'lib/declarative_authorization/development_support/change_supporter.rb', line 189
def weight
1
end
|